我使用的是macOs,即使通过npm全局并发安装,但在package.json中将其设置为启动脚本并键入npm start时,仍会出现以下错误。
concurrently - kill-others "npm run server" "npm run client"
sh: concurrently - kill-others: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! thesis_fullstack@1.0.0 start: `concurrently - kill-others "npm run server" "npm run client"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the thesis_fullstack@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! /Users/mantzaris/.npm/_logs/2020-04-25T22_40_12_897Z-debug.log我的package.json文件:
{
"name": "thesis_fullstack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"client": "cd client && npm start",
"server": "cd server && npm start",
"start": "concurrently - kill-others \"npm run server\" \"npm run client\""
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"concurrently": "3.5.1"
}
}发布于 2020-04-26 21:57:14
我真的不知道我做了什么来修复它。首先,我将命令标志"typo“修改为并发的--kill-others your_commands_here。然后我手动卸载了node,并通过Homebrew重新安装(因为我使用的是MacOs)。在此之后,节点和npm将完全不起作用。修复为:https://stackoverflow.com/a/54583099/13212764。我认为在这一点上运行npm start是可行的。
发布于 2020-04-26 07:11:19
您需要在本地安装依赖项,以便在任何启动脚本中使用它。运行
npm install --save concurrently要将其本地安装到项目中,请执行以下操作
发布于 2020-04-26 08:39:16
您的错误与包本身无关,您可以将其全局保存,也可以将其保存在本地(不是-- save -dev)。
您可以在错误日志中找到问题的解决方案
concurrently - kill-others "npm run server" "npm run client"
sh: concurrently - kill-others: command not found该命令应该是--kill-others或简称为-k,以下是官方文档:https://github.com/kimmobrunfeldt/concurrently
尝试将此作为您的package.json
{
"name": "thesis_fullstack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"client": "cd client && npm start",
"server": "cd server && npm start",
"start": "concurrently --kill-others \"npm run server\" \"npm run client\""
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"concurrently": "3.5.1"
}
}干杯:)
https://stackoverflow.com/questions/61433713
复制相似问题