5

I'm not able to npm start anymore due to a problem with the util npm I think. I tried to update all the packages and to remove util and re-install it. How could I solve this?


Error: Cannot find module './util/resolveCommand'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/cyruslognonne/Dropbox/C-T-L-K_Master/A_Mandats/A_En cours/LEV/B_Jam/lev_dev/node_modules/cross-spawn/lib/parse.js:3:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lev_dev@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the lev_dev@0.1.0 start 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!     /Users/cyruslognonne/.npm/_logs/2017-12-03T19_21_25_874Z-debug.log

Here's my package.json.

{
  "name": "lev_dev",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "package.json": "^2.0.1",
    "react": "^16.1.1",
    "react-dom": "^16.1.1",
    "react-marquee": "^0.1.1",
    "react-scripts": "1.0.17",
    "react-slick": "^0.15.4",
    "slick-carousel": "^1.8.1",
    "util": "^0.10.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

Thanks, Cyrus

Cyrus Khalatbari
  • 117
  • 1
  • 2
  • 7
  • Sometimes you could get this error even if you have imported a package that is in tools package. I was getting for this logger package. const logger = require('./utils/logger'); – Achilleus Aug 07 '19 at 15:31

2 Answers2

17

As the error states, the problem is with the cross-spawn module, which is used by react-scripts. The issue is not because of util module.

Try the following to update the dependencies properly and see if it works.

npm install -g npm@latest # to update npm.
rm -rf node_modules # to remove the existing modules.
npm install # to re-install the project dependencies.
Ollie
  • 1,641
  • 1
  • 13
  • 31
Muthukumar
  • 8,679
  • 17
  • 61
  • 86
0

You firstly need to

  • npm clean cache force and then go to your git bash if you are using windows and run
  • rm -rf node_modules and after removing the node_modules then run
  • npm install