0

Well after I deployed my app to Heroku I changed some of my code on my local machine. After I tried to npm run start script I got this ERR for the first time. In the log, you can see that the ERR is not from some specific package. I tried to delete the node_modules folder and the package-JSON.lock (manually) and run:

npm cache clean --force

delete the folder of node_modules and package-JSON.lock manually I didn't manage to use rm -rf node_modules package-lock.json

npm install

on npm install, I had one error so I used npm install --force

solutions I tried: How to solve npm error "npm ERR! code ELIFECYCLE" What does the ELIFECYCLE Node.js error mean?

my log file:

0 info it worked if it ends with ok
1 verbose cli [
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   'run',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle natours@1.0.0~prestart: natours@1.0.0
6 info lifecycle natours@1.0.0~start: natours@1.0.0
7 verbose lifecycle natours@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle natours@1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Projects\natours-project\node_modules\.bin;C:\Python38\Scripts\;C:\Python38\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\Asus\AppData\Local\Microsoft\WindowsApps;;C:\Users\Asus\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Asus\AppData\Roaming\npm;C:\Program Files\heroku\bin
9 verbose lifecycle natours@1.0.0~start: CWD: C:\Projects\natours-project
10 silly lifecycle natours@1.0.0~start: Args: [ '/d /s /c', 'node server.js' ]
11 silly lifecycle natours@1.0.0~start: Returned: code: 1  signal: null
12 info lifecycle natours@1.0.0~start: Failed to exec start script
13 verbose stack Error: natours@1.0.0 start: `node server.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid natours@1.0.0
15 verbose cwd C:\Projects\natours-project
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
18 verbose node v12.18.3
19 verbose npm  v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error natours@1.0.0 start: `node server.js`
22 error Exit status 1
23 error Failed at the natours@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

My code at GitHub: https://github.com/adids1221/natours-project

Adi
  • 11
  • 1
  • 6
  • try updating npm with `npm install -g npm@latest` and then remove package-lock.json, node_modules and do a fresh npm install – Rajika Imal Oct 15 '20 at 09:25
  • as you're on windows rm wouldn't work, use `rmdir d:\projectpath\node_modules /s /q` to delete node_modules – Rajika Imal Oct 15 '20 at 09:31
  • Thank you, it did work but when I add if statement to my code I have this error again somehow – Adi Oct 15 '20 at 13:44

0 Answers0