我看过几个类似的问题,但是没有一个答案能解决我的问题。
问题是,我正在尝试运行快速服务器,但我对此并不感到困惑,我只需要中间件就可以在前端做一些事情。
我正在运行的命令是:
npm start
"start": "nodemon --exec npm run babel-node src/server.js"
我也尝试直接执行这两个
nodemon --exec npm run babel-node src/server.js
npm run babel-node src/server.js
然后我得到以下错误:
middleware > npm run babel-node src/server.js
> server@2.4.0 babel-node /mnt/sda4/Development/coding/Profissional/middleware
> babel-node "src/server.js"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server@2.4.0 babel-node: `babel-node "src/server.js"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server@2.4.0 babel-node 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/user1/.npm/_logs/2019-07-24T14_49_23_222Z-debug.log
并在日志文件中:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'run',
1 verbose cli 'babel-node',
1 verbose cli 'src/server.js' ]
2 info using npm@6.10.2
3 info using node@v11.15.0
4 verbose run-script [ 'prebabel-node', 'babel-node', 'postbabel-node' ]
5 info lifecycle server@2.4.0~prebabel-node: server@2.4.0
6 info lifecycle server@2.4.0~babel-node: server@2.4.0
7 verbose lifecycle server@2.4.0~babel-node: unsafe-perm in lifecycle true
8 verbose lifecycle server@2.4.0~babel-node: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/sda4/Development/coding/Profissional/middleware/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
9 verbose lifecycle server@2.4.0~babel-node: CWD: /mnt/sda4/Development/coding/Profissional/middleware
10 silly lifecycle server@2.4.0~babel-node: Args: [ '-c', 'babel-node "src/server.js"' ]
11 silly lifecycle server@2.4.0~babel-node: Returned: code: 1 signal: null
12 info lifecycle server@2.4.0~babel-node: Failed to exec babel-node script
13 verbose stack Error: server@2.4.0 babel-node: `babel-node "src/server.js"`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
13 verbose stack at EventEmitter.emit (events.js:193: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:193:13)
13 verbose stack at maybeClose (internal/child_process.js:999:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid server@2.4.0
15 verbose cwd /mnt/sda4/Development/coding/Profissional/middleware
16 verbose Linux 5.2.2-arch1-1-ARCH
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "babel-node" "src/server.js"
18 verbose node v11.15.0
19 verbose npm v6.10.2
20 error code ELIFECYCLE
21 error errno 1
22 error server@2.4.0 babel-node: `babel-node "src/server.js"`
22 error Exit status 1
23 error Failed at the server@2.4.0 babel-node script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]