This is my first time using nodejs, I am getting the following error while running npm run start
command. Is there a version compatibility issue between node and npm? I can see that the end lines suggesting this is not an issue with npm.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/home/iamuser/.nvm/versions/node/v14.17.6/bin/node',
1 verbose cli '/home/iamuser/.nvm/versions/node/v14.17.6/bin/npm',
1 verbose cli 'run',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm@6.14.15
3 info using node@v14.17.6
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle test-api@1.0.0~prestart: test-api@1.0.0
6 info lifecycle test-api@1.0.0~start: test-api@1.0.0
7 verbose lifecycle test-api@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle test-api@1.0.0~start: PATH: /home/iamuser/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/iamuser/Documents/JS/rapid_api/test-api/node_modules/.bin:/home/iamuser/.nvm/versions/node/v14.17.6/bin:/home/iamuser/anaconda3/bin:/home/iamuser/anaconda3/condabin:/home/iamuser/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle test-api@1.0.0~start: CWD: /home/iamuser/Documents/JS/rapid_api/test-api
10 silly lifecycle test-api@1.0.0~start: Args: [ '-c', 'nodemon index.js' ]
11 info lifecycle test-api@1.0.0~start: Failed to exec start script
12 verbose stack Error: test-api@1.0.0 start: `nodemon index.js`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/home/iamuser/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:400:28)
12 verbose stack at maybeClose (internal/child_process.js:1055:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid test-api@1.0.0
14 verbose cwd /home/iamuser/Documents/JS/rapid_api/test-api
15 verbose Linux 5.11.0-44-generic
16 verbose argv "/home/iamuser/.nvm/versions/node/v14.17.6/bin/node" "/home/iamuser/.nvm/versions/node/v14.17.6/bin/npm" "run" "start"
17 verbose node v14.17.6
18 verbose npm v6.14.15
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error test-api@1.0.0 start: `nodemon index.js`
23 error spawn ENOENT
24 error Failed at the test-api@1.0.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
package.json:
{
"name": "test-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon index.js"
},
"author": "iamuser",
"license": "ISC",
"dependencies": {
"axios": "^0.24.0",
"cheerio": "^1.0.0-rc.10",
"express": "^4.17.1"
}
}
As @ndenasie said, nodemon
isn't installed. Try running npm install -g nodemon
then npm run start
and it should work.
Since the comment worked, this is just a response for you to mark as the best answer to close the thread.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.