运行 "npm run build" 需要什么?

What is needed to run "npm run build"?

运行 npm run build 需要什么?

我有项目 vue

我想安装到新服务器

我只需要运行npm install吗?

通常 npm run build 将创建一个生产版本。

构建过程为您做了很多事情:

  • 转译JS代码
  • 捆绑代码和资产
  • 对资产使用缓存清除技术
  • 删除死代码

使用生产构建是进行生产的方式。

稍后编辑:

您应该安装 npm 才能执行 运行 npm 命令。在 运行ning npm run build.

之前你还应该 运行 npm install

您需要 package.json 包含:

  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
  }

并且还必须包含这样的依赖项

 "dependencies": {
    "style-loader": "^1.1.4",
    "vue": "^2.6.11",
    "vuex": "^3.3.0"
  },