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

Jest setup: Cannot find module 'next/jest' #32682

Closed
alexbu92 opened this issue Dec 20, 2021 · 2 comments
Closed

Jest setup: Cannot find module 'next/jest' #32682

alexbu92 opened this issue Dec 20, 2021 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@alexbu92
Copy link

What version of Next.js are you using?

12.0.1

What version of Node.js are you using?

14.18.1

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying your application?

next start

Describe the Bug

Following the official docs for installing Jest, when I got to the end and tried running npm run test I get the following error:

Error: Cannot find module 'next/jest'
Require stack:
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/jest.config.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest-util/build/requireOrImportModule.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest-util/build/index.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest-config/build/getCacheDirectory.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest-config/build/Defaults.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest-config/build/normalize.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest-config/build/index.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest/node_modules/jest-cli/build/init/index.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest/node_modules/jest-cli/build/cli/index.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest/node_modules/jest-cli/bin/jest.js
- /mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/node_modules/jest/bin/jest.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (/mnt/d/Projects/Web-Projects/Hastega/nextjs-react-starter-kit/jest.config.js:2:18)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)

Upon further inspection, there is no jest folder inside the next node_modules folder. Why am I missing it?

Expected Behavior

That the next/jest module is installed.

To Reproduce

install next@12.0.1 and follow the official docs for setting up jest with rust compiler.

@alexbu92 alexbu92 added the bug Issue was opened via the bug report template. label Dec 20, 2021
@balazsorban44
Copy link
Member

it has been added at a later point #31246

Please upgrade with npm i next@lateat

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants