Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0 - Error: Cannot find module next/script imported from @prismicio/next/dist/PrismicPreview.js #105

Open
charles4221 opened this issue Feb 7, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@charles4221
Copy link

charles4221 commented Feb 7, 2025

I have just upgraded a project from @prismicio/next v1.7.1 to 2.0.0 as well as @prismicio/react v2.9.1 to 3.0.0 and even with no other changes, the next dev command (and any other command that needs to parse the module imports, e.g. linting/testing/etc.) now fails with a Cannot find module error:

Versions

  • @prismicio/next: 2.0.0
  • next: 15.1.6
  • node: 22.13.1

Reproduction

I've pushed the update to this branch on my personal website which produces the error when you pull this code and try to run:

npm i
npm run dev // OR npm run lint, etc.

Link to repro: https://github.com/charles4221/charlesharwood.dev/tree/feat/prismic-upgrades-next-2-react-3

Error Log

-> % npm run dev

> charlesharwood@2.0.0 dev
> concurrently "npm:dev:next" "npm:dev:slicemachine" --names "next,slicemachine" --prefix-colors blue,magenta

[next] 
[next] > charlesharwood@2.0.0 dev:next
[next] > next dev
[next] 
[slicemachine] 
[slicemachine] > charlesharwood@2.0.0 dev:slicemachine
[slicemachine] > start-slicemachine
[slicemachine] 
[next] node:internal/process/promises:394
[next]     triggerUncaughtException(err, true /* fromPromise */);
[next]     ^
[next] 
[next] Error: Cannot find module '/Users/REDACTED/node_modules/next/script' imported from /Users/REDACTED/node_modules/@prismicio/next/dist/PrismicPreview.js
[next] Did you mean to import "next/script.js"?
[next]     at finalizeResolution (node:internal/modules/esm/resolve:275:11)
[next]     at moduleResolve (node:internal/modules/esm/resolve:932:10)
[next]     at defaultResolve (node:internal/modules/esm/resolve:1056:11)
[next]     at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
[next]     at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
[next]     at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:353:53)
[next]     at new ModuleJobSync (node:internal/modules/esm/module_job:341:34)
[next]     at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:413:11)
[next]     at new ModuleJobSync (node:internal/modules/esm/module_job:341:34)
[next]     at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:326:11) {
[next]   code: 'ERR_MODULE_NOT_FOUND',
[next]   url: 'file:///Users/REDACTED/node_modules/next/script'
[next] }
[next] 
[next] Node.js v22.13.1
[next] npm run dev:next exited with code 1
@charles4221 charles4221 added the bug Something isn't working label Feb 7, 2025
Copy link

github-actions bot commented Feb 7, 2025

This issue has been labeled as a bug since it was created using the 🚨 Bug Report Template.

Hi there, thank you so much for the report!

Following our Maintenance Process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue includes the following:

  • Information about your environment and packages you use (Node.js version, package names and their versions, etc.)
    Feel free to attach a copy of your package.json file.
  • Any troubleshooting steps you already went through
  • A minimal reproduction of the issue, and/or instructions on how to reproduce it

If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request address it. Check out our quick start guide for a simple contribution process.

If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io

- The Prismic Open-Source Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant