首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“未找到并发命令”,但已全局安装

“未找到并发命令”,但已全局安装
EN

Stack Overflow用户
提问于 2020-04-26 06:59:04
回答 3查看 2.6K关注 0票数 0

我使用的是macOs,即使通过npm全局并发安装,但在package.json中将其设置为启动脚本并键入npm start时,仍会出现以下错误。

代码语言:javascript
复制
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文件:

代码语言:javascript
复制
{
  "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"
  }
}
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2020-04-26 21:57:14

我真的不知道我做了什么来修复它。首先,我将命令标志"typo“修改为并发的--kill-others your_commands_here。然后我手动卸载了node,并通过Homebrew重新安装(因为我使用的是MacOs)。在此之后,节点和npm将完全不起作用。修复为:https://stackoverflow.com/a/54583099/13212764。我认为在这一点上运行npm start是可行的。

票数 0
EN

Stack Overflow用户

发布于 2020-04-26 07:11:19

您需要在本地安装依赖项,以便在任何启动脚本中使用它。运行

代码语言:javascript
复制
npm install --save concurrently

要将其本地安装到项目中,请执行以下操作

票数 0
EN

Stack Overflow用户

发布于 2020-04-26 08:39:16

您的错误与包本身无关,您可以将其全局保存,也可以将其保存在本地(不是-- save -dev)。

您可以在错误日志中找到问题的解决方案

代码语言:javascript
复制
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

代码语言:javascript
复制
{
  "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"
  }
}

干杯:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61433713

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档