npm start error -4058 ELIFECYCLE ENOENT

1k views Asked by At

I am new to React and I have been trying to start my new project. When I run 'npm start', I get the following error:

'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command, operable program or batch file.

> [email protected] start C:\React\reactProject
> npm run build

npm ERR! file C:\Windows\system32\
npm ERR! path C:\Windows\system32\
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn C:\Windows\system32\
npm ERR! [email protected] start: `npm run build`
npm ERR! spawn C:\Windows\system32\ ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! code ELIFECYCLE
npm ERR! errno -4058
npm ERR! [email protected] start: `npm run build`
npm ERR! Exit status -4058
npm ERR!
npm ERR! Failed at the [email protected] 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!     C:\Users\steve\AppData\Roaming\npm-cache\_logs\2017-09-01T09_33_35_096Z-debug.log

Here is my package.json:

{
  "name": "reactproject",
  "version": "1.0.0",
  "description": "ReactJS project",
  "main": "index.js",
  "scripts": {
    "start": "npm run build",
    "build": "webpack -d && xcopy \"src/index.html\" \"dist/\" /F /Y && webpack-dev-server --content-base src/ --inline",
    "build:prod": "webpack -p && xcopy \"src/index.html\" \"dist/\" /F /Y"
  },
  "keywords": [
    "reactjs"
  ],
  "author": "author",
  "license": "MIT",
  "dependencies": {
    "react": "^15.6.1",
    "react-dom": "^15.6.1"
  },
  "devDependencies": {
    "babel-core": "^6.26.0"
  }
}

And debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\React\reactProject\node_modules\.bin;C:\Program Files\Java\jre1.8.0_121\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\nodejs\;C:\Users\steve\AppData\Local\Microsoft\WindowsApps;C:\Users\steve\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: C:\React\reactProject
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'npm run build' ]
11 info lifecycle [email protected]~start: Failed to exec start script
12 verbose stack Error: [email protected] start: `npm run build`
12 verbose stack spawn C:\Windows\system32\ ENOENT
12 verbose stack     at _errnoException (util.js:1041:11)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
12 verbose stack     at onErrorNT (internal/child_process.js:374:16)
12 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
12 verbose stack     at process._tickCallback (internal/process/next_tick.js:180:9)
13 verbose pkgid [email protected]
14 verbose cwd C:\React\reactProject
15 verbose Windows_NT 10.0.14393
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
17 verbose node v8.4.0
18 verbose npm  v5.3.0
19 error file C:\Windows\system32\
20 error path C:\Windows\system32\
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn C:\Windows\system32\
24 error [email protected] start: `npm run build`
24 error spawn C:\Windows\system32\ ENOENT
25 error Failed at the [email protected] start script.
25 error This is probably not a problem with npm. There is likely additional logging output above.
26 verbose exit [ 1, true ]

I have tried googling similar problem, but the only advice I have found was changing the scripts (which I did) and installing babel-core. Also, I ran 'npm run build' instead of 'npm start', but still got the same error.

I suspect that the issue might be with environment variables (wrong path), but even if I am right, I don't know how to fix it.

Thanks for any response.

0

There are 0 answers