Skip to content

Module not found: Can't resolve 'rdf-canonize-native' during build in RDFLib dependency #567

@danielbakas

Description

@danielbakas

Hi!

While building a Next.js project that includes RDFLib (rdflib@2.2.37), the build fails due to a missing module error in rdf-canonize:

Module not found: Can't resolve 'rdf-canonize-native' in '.../node_modules/.pnpm/rdf-canonize@3.4.0/node_modules/rdf-canonize/lib'

This error seems to originate from rdf-canonize, which is a dependency of jsonld, which in turn is required by RDFLib.

Steps to Reproduce

  1. Create a Next.js project (next@15.2.1).
  2. Install rdflib@2.2.37 using pnpm.
  3. Run next build.

Expected Behavior

The build should complete successfully without missing dependencies.

Actual Behavior

  • The build fails with Module not found: Can't resolve 'rdf-canonize-native'.
  • The issue appears in the dependency chain: rdflib → jsonld → rdf-canonize.
  • A separate TypeError: Cannot set properties of undefined (setting 'WordArray') also appears in the logs.

Environment

  • Package Manager: pnpm
  • RDFLib Version: 2.2.37
  • Next.js Version: 15.2.1
  • Node.js Version: 23.9.0

Attempts to solve

  • Add rdf-canonize-native dependency → Failed (different error) at installation

Full Log

next dev

   ▲ Next.js 15.2.1
   - Local:        http://localhost:3000
   - Network:      http://192.168.68.105:3000

 ✓ Starting...
 ✓ Ready in 2.7s
 ○ Compiling / ...
 ⚠ ./node_modules/.pnpm/rdf-canonize@3.4.0/node_modules/rdf-canonize/lib/index.js
Module not found: Can't resolve 'rdf-canonize-native' in '.../node_modules/.pnpm/rdf-canonize@3.4.0/node_modules/rdf-canonize/lib'

Import trace for requested module:
./node_modules/.pnpm/rdf-canonize@3.4.0/node_modules/rdf-canonize/lib/index.js
./node_modules/.pnpm/rdf-canonize@3.4.0/node_modules/rdf-canonize/index.js
./node_modules/.pnpm/jsonld@8.3.3_web-streams-polyfill@3.3.3/node_modules/jsonld/lib/jsonld.js
./node_modules/.pnpm/jsonld@8.3.3_web-streams-polyfill@3.3.3/node_modules/jsonld/lib/index.js
./node_modules/.pnpm/rdflib@2.2.37_web-streams-polyfill@3.3.3/node_modules/rdflib/esm/jsonldparser.js
./node_modules/.pnpm/rdflib@2.2.37_web-streams-polyfill@3.3.3/node_modules/rdflib/esm/fetcher.js
./node_modules/.pnpm/rdflib@2.2.37_web-streams-polyfill@3.3.3/node_modules/rdflib/esm/index.js

Conclusion

Thank you in advance!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions