Skip to content

create-next-app (js): Cannot find module 'react' #204

@bbigras

Description

@bbigras
nix shell "nixpkgs#nodejs"

npx create-next-app@latest test-next-dream

cd test-next-dream

rm -rf node_modules

nix flake init -t github:nix-community/dream2nix#simple

nix eval --impure --raw --expr 'builtins.currentSystem' > ./nix_systems && git add ./nix_systems

nix flake show

nix develop

npm run dev

output of the last command

[bbigras@desktop:~/dev/test-next-dream]$ npm run dev

> [email protected] dev /home/bbigras/dev/test-next-dream
> next dev

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'react'
Require stack:
- /nix/store/bpdi0095q7ww9fy886409cs8mxzjsw6m-next-12.2.2/lib/node_modules/next/dist/server/utils.js
- /nix/store/bpdi0095q7ww9fy886409cs8mxzjsw6m-next-12.2.2/lib/node_modules/next/dist/bin/next
    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:101:18)
    at Object.<anonymous> (/nix/store/bpdi0095q7ww9fy886409cs8mxzjsw6m-next-12.2.2/lib/node_modules/next/dist/server/utils.js:11:37)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/nix/store/bpdi0095q7ww9fy886409cs8mxzjsw6m-next-12.2.2/lib/node_modules/next/dist/server/utils.js',
    '/nix/store/bpdi0095q7ww9fy886409cs8mxzjsw6m-next-12.2.2/lib/node_modules/next/dist/bin/next'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bbigras/.npm/_logs/2022-07-19T19_30_09_416Z-debug.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnodejs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions