gpt4 book ai didi

node.js - 如何修复使用命令 npm run build 时显示的错误?

转载 作者:太空宇宙 更新时间:2023-11-04 01:39:03 25 4
gpt4 key购买 nike

我尝试运行 npm run build 输出如下错误:

   root@tim-VPCEB42EG:/home/tavinder/es6# npm run build
npm ERR! Linux 4.15.0-39-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2

npm ERR! missing script: build
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR! /home/tavinder/es6/npm-debug.log

最佳答案

这意味着您缺少一个脚本。NPM 应该知道执行该命令时要运行哪个脚本。如果您有构建脚本,请在 package.json 的脚本下:

"scripts": {
"test": "jest"
"build": "name of your build script"
},

例如,在我的一个项目中,

"scripts": {
"lint": "./node_modules/.bin/eslint .",
"lint:fix": "./node_modules/.bin/eslint . --fix || true",
"build": "babel src -d dist --presets es2015",
.....
}

关于node.js - 如何修复使用命令 npm run build 时显示的错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53570620/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com