最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - npm run start, Failed at the start script - Stack Overflow

programmeradmin3浏览0评论

This is my first time using nodejs, I am getting the following error while running npm run start mand. Is there a version patibility 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 [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: /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 [email protected]~start: CWD: /home/iamuser/Documents/JS/rapid_api/test-api
10 silly lifecycle [email protected]~start: Args: [ '-c', 'nodemon index.js' ]
11 info lifecycle [email protected]~start: Failed to exec start script
12 verbose stack Error: [email protected] 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 [email protected]
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 [email protected] start: `nodemon index.js`
23 error spawn ENOENT
24 error Failed at the [email protected] 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"
  }
}

This is my first time using nodejs, I am getting the following error while running npm run start mand. Is there a version patibility 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 [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: /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 [email protected]~start: CWD: /home/iamuser/Documents/JS/rapid_api/test-api
10 silly lifecycle [email protected]~start: Args: [ '-c', 'nodemon index.js' ]
11 info lifecycle [email protected]~start: Failed to exec start script
12 verbose stack Error: [email protected] 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 [email protected]
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 [email protected] start: `nodemon index.js`
23 error spawn ENOENT
24 error Failed at the [email protected] 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"
  }
}
Share Improve this question edited Jan 9, 2022 at 17:03 palash asked Jan 9, 2022 at 16:49 palashpalash 5394 silver badges15 bronze badges 8
  • 1 Could you please, provide the package.json file? – Guillermo González Commented Jan 9, 2022 at 16:52
  • 1 Try running npm install then npm run start. I'm guessing that nodemon is not installed yet – ndemasie Commented Jan 9, 2022 at 17:00
  • 1 @ndemasie you were right, nodemon was not installed, I tried npm install nodemon and it worked! – palash Commented Jan 9, 2022 at 17:08
  • 1 @palash, run npm list -g --depth=0 if you don't see nodemon then run npm install -g nodemon – ndemasie Commented Jan 9, 2022 at 17:09
  • 1 @ndemasie it worked with simply npm install demon, but nodemon was only visible in npm list -g --depth=0 after I did npm install -g nodemon – palash Commented Jan 9, 2022 at 17:13
 |  Show 3 more ments

1 Answer 1

Reset to default 5

As @ndenasie said, nodemon isn't installed. Try running npm install -g nodemon then npm run start and it should work.

发布评论

评论列表(0)

  1. 暂无评论