首页 > 解决方案 > 如何解决 npm run build command not found 错误?

问题描述

我的脚本中有这个

"scripts": {
    "start": "webpack",
    "compile": "tsc -p tsconfig.sequences.json",
    "build": "npm-run-all -p compile start",

但是收到此错误消息

sh: npm-run-all: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! workshop4@1.0.0 build: `npm-run-all -p compile start`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the workshop4@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我有版本 6.13.4 npm 和节点 12.14

标签: visual-studionpm

解决方案


您可能没有npm-run-all正确安装。

我建议确保您在本地安装它:

npm i -s npm-run-all

然后你应该可以在 npm-scripts 中使用它。

有关如何根据安装方式使用 npm 模块中的命令的更多上下文,请参阅此答案:

https://stackoverflow.com/a/65773947/3612177


推荐阅读