运行“craco build”时出现错误
执行命令:
npm run dist
如果我从同一文件夹运行 npm run build
,也会出现同样的错误。
package.json 文件中的命令:
"scripts": {
"start": "npm run storybook:start",
"dev": "craco start",
"build": "craco build",
"dist": "npm run build && del-cli build/*.* build/fonts",
"test": "craco test",
"lint": "eslint . --ext .js,.jsx --ignore-path .gitignore",
"eject": "react-scripts eject",
-----------------
错误输出
craco build
'craco' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
如果我通过运行 npm info craco version
检查 craco 版本,那么我会收到 0.0.3
。
我运行的是 Node v8.0.0,npm 版本是 5.0.0
由于一些项目特定条件,我使用 Node v8.0.0。
最佳答案
使用此命令
npm install @craco/craco --save
关于node.js - 通过 npm run 为 Reactjs 项目运行构建命令时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59957683/