简体   繁体   English

节点构建命令不起作用

[英]Node build command not working

I am using this config in package.json file for running webpack dev server. 我在package.json文件中使用此配置来运行webpack dev服务器。 I want to use a build command as well, but its not working for me 我也想使用构建命令,但它不适用于我

{
  "name": "Demo",
  "version": "1.0.0",
  "description": "Demo App",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server --hot",
    "build": "webpack --watch"
},

npm start command works fine, but build isn't npm start命令工作正常,但构建不是

You will have to use npm run build because build is an internal built in keyword (see docs here: https://docs.npmjs.com/cli/build ). 您将不得不使用npm run build因为build是一个内置的内置关键字(请参阅此处的文档: https//docs.npmjs.com/cli/build )。

Therefore: 因此:

npm build // refers to built in

and.. 和..

npm run build // refers to your script

我想你应该用这个:

   npm run build

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM