npm ERR! missing script build

一世执手 提交于 2019-12-13 05:36:12

问题


I'm using Windows 10 and powershell, trying to run a webpack app cloned from my github.

When I type npm run start I get:

npm ERR! missing script: build;

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"
},

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.

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.


回答1:


In the root folder of your directory (or in whichever folder your webpack.config file is stored) run:

node_modules/.bin/webpack-dev-server

This gives command line access to the npm run start command

For further information:

https://www.npmjs.com/package/webpack-dev-server



来源:https://stackoverflow.com/questions/49470273/npm-err-missing-script-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!