我正在尝试使用create-react-app
作为前端,express
作为后端,使用concurrently
软件包来建立一个项目,以使两个应用程序同时运行。但是,每次尝试从ELIFECYCLE
开始时,我都会遇到错误npm run start
,并且阅读日志并不能使我了解正在发生的事情。
有人可以帮我一下吗?
package.json
{
"name": "demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"client": "cd client && npm start",
"back-end": "cd back-end && npm start",
"start": "concurrently --kill-others \"npm run back-end\" \"npm run client\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/xyz/xyz.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"concurrently": "^4.1.0"
}
}
错误日志:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/11.13.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'start' ]
2 info using npm@6.7.0
3 info using node@v11.13.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle xyz@1.0.0~prestart: xyz@1.0.0
6 info lifecycle xyz@1.0.0~start: xyz@1.0.0
7 verbose lifecycle xyz@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle xyz@1.0.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/xyz/Code/xyz/node_modules/.bin:/Users/xyz/anaconda3/bin:/Users/xyz/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle xyz@1.0.0~start: CWD: /Users/xyz/Code/xyz
10 silly lifecycle xyz@1.0.0~start: Args: [ '-c',
10 silly lifecycle 'concurrently --kill-others "npm run back-end" "npm run client"' ]
11 silly lifecycle xyz@1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle xyz@1.0.0~start: Failed to exec start script
13 verbose stack Error: xyz@1.0.0 start: `concurrently --kill-others "npm run back-end" "npm run client"`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:193:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/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:1001:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid xyz@1.0.0
15 verbose cwd /Users/xyz/Code/xyz
16 verbose Darwin 18.5.0
17 verbose argv "/usr/local/Cellar/node/11.13.0/bin/node" "/usr/local/bin/npm" "run" "start"
18 verbose node v11.13.0
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error xyz@1.0.0 start: `concurrently --kill-others "npm run back-end" "npm run client"`
22 error Exit status 1
23 error Failed at the xyz@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 ]