4

I have a project on Github that ignores the node_modules folder, so I changed my computer and and cloned the repository again. I used the npm-install-all install all node dependencies, it used to work. But today when doing this and running react-scripts start I had this problem:

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

Error: Cannot find module 'which'
Require stack:
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\node_modules\cross-spawn\lib\util\resolveCommand.js
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\node_modules\cross-spawn\lib\parse.js 
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\node_modules\cross-spawn\index.js     
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\crossSpawn.js
- C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-scripts\bin\react-scripts.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\jessica.marchi\Documents\GitHub\AUDIT-APP\node_modules\react-dev-utils\node_modules\cross-spawn\lib\util\resolveCommand.js:4:13)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-dev-utils\\node_modules\\cross-spawn\\lib\\util\\resolveCommand.js',
    'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-dev-utils\\node_modules\\cross-spawn\\lib\\parse.js',
    'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-dev-utils\\node_modules\\cross-spawn\\index.js',
    'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-dev-utils\\crossSpawn.js',
    'C:\\Users\\jessica.marchi\\Documents\\GitHub\\AUDIT-APP\\node_modules\\react-scripts\\bin\\react-scripts.js'       
  ]

I already tried to update the modules with npm install. Has anyone been through this and can you help me, please?

Thanks.

3 Answers3

2

I finally got it! If you have the same problem, try:

rm -rf node_modules

then remove your package-lock.json and

npm install
0

For me it was an xcode issue.

Remove xcode cli tools: sudo rm -r -f /Library/Developer/CommandLineTools Reinstall: xcode-select --install Then, delete node modules. Manually or with rm -rf node_modules Should be good to go: npm install then npm start

https://github.com/haileemiu/Notes/blob/main/Troubleshooting/npm.md

Hailee
  • 288
  • 1
  • 4
  • 13
0

this problem occur in node version-17 just download version-16 and it works

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31254406) – Marek Urbanowicz Mar 13 '22 at 19:26