npm 错误!缺少脚本构建 [英] npm ERR! missing script build
问题描述
我正在使用 Windows 10 和 powershell,尝试运行从我的 github 克隆的 webpack 应用程序.
I'm using Windows 10 and powershell, trying to run a webpack app cloned from my github.
当我输入 npm run start
我得到:
npm 错误!缺少脚本:构建;
构建脚本绝对在我的 package.json 中:
The build script is most definitely in my package.json:
"scripts": {
"build": "webpack --mode development",
"start": "npm run build; webpack-dev-server --open",
"lint": "eslint src/*.js",
"test": "karma start karma.conf.js"
},
当我使用 mac 时,npm run start
打开本地开发服务器就好了.
When I'm on a mac, npm run start
opens a local dev server just fine.
任何想法为什么我无法在我的电脑上运行它?我是菜鸟程序员.用简单的英语写的答案将不胜感激.
Any ideas why I am unable to run this on my pc? I am a rookie programmer. Answers written in plain English will be greatly appreciated.
包含此项目配置文件的 github 存储库:
The github repo with this project's config files:
https://github.com/GreanBeetle/api-project
我也很高兴发布运行日志.
I am happy to post the run log as well.
推荐答案
在您目录的根文件夹(或存储 webpack.config 文件的任何文件夹中)运行:
In the root folder of your directory (or in whichever folder your webpack.config file is stored) run:
node_modules/.bin/webpack-dev-server
这使命令行可以访问 npm run start
命令
This gives command line access to the npm run start
command
更多信息:
https://www.npmjs.com/package/webpack-dev-server
这篇关于npm 错误!缺少脚本构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!