我有一个简单的快速应用https://github.com/stuartabrown/express-google-assistant/tree/feature/new-simple-react。一切都可以在本地正常运行。
但是,当我将代码放到远程服务器(Ubuntu 16.04,节点版本v12.3.1,NPM v6.9.0)并运行npm install
然后运行npm start
时,我得到了错误:
internal/modules/cjs/loader.js:626
throw err;
^
Error: Cannot find module 'npm audit'
Require stack:
- /home/stuart/express-google-assistant/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)
at Function.Module._load (internal/modules/cjs/loader.js:527:27)
at Module.require (internal/modules/cjs/loader.js:681:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/home/stuart/express-google-assistant/index.js:5:15)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/stuart/express-google-assistant/index.js' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express-starter-kit@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the express-starter-kit@1.0.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! /home/stuart/.npm/_logs/2019-05-24T20_47_26_272Z-debug.log
/home/stuart/.npm/_logs/2019-05-24T20_47_26_272Z-debug.log的输出为
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.9.0
3 info using node@v12.3.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle express-starter-kit@1.0.0~prestart: express-starter-kit@1.0.0
6 info lifecycle express-starter-kit@1.0.0~start: express-starter-kit@1.0.0
7 verbose lifecycle express-starter-kit@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle express-starter-kit@1.0.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/stuart/express-google-assistant/node_modules/.bin:/home/stuart/bin:/home/stuart/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle express-starter-kit@1.0.0~start: CWD: /home/stuart/express-google-assistant
10 silly lifecycle express-starter-kit@1.0.0~start: Args: [ '-c', 'node index.js' ]
11 silly lifecycle express-starter-kit@1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle express-starter-kit@1.0.0~start: Failed to exec start script
13 verbose stack Error: express-starter-kit@1.0.0 start: `node index.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:200:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:200:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid express-starter-kit@1.0.0
15 verbose cwd /home/stuart/express-google-assistant
16 verbose Linux 4.4.0-148-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v12.3.1
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error express-starter-kit@1.0.0 start: `node index.js`
22 error Exit status 1
23 error Failed at the express-starter-kit@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 ]
EDIT
package.json的详细信息是:
{
"name": "express-starter-kit",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node -r dotenv/config index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"actions-on-google": "^2.0.0",
"body-parser": "^1.18.3",
"express": "^4.16.4",
"firebase-admin": "^8.0.0",
"firebase-functions": "^2.3.1"
},
"devDependencies": {
"dotenv": "^6.2.0",
"nodemon": "^1.18.9",
"ngrok": "^3.1.1"
}
}
对于如何解决此问题,我有些困惑,不胜感激。