使用npm install --production后遇到“'vue-cli-service'被识别为内部或外部命令” >>

问题描述 投票:0回答:1

我们的生产环境必须使用“ npm install --production”来安装项目,但是在触发“ npm run serve”时遇到以下错误:

'vue-cli-service'不被识别为内部或外部命令,可操作的程序或批处理文件。npm ERR!代码ELIFECYCLEnpm ERR! errno 1

这里是命令序列:

  1. npm install --production
  2. npm运行发球
  3. 下面是package.json

{
  "name": "xxxxxx",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "bootstrap": "^4.4.1",
    "bootstrap-vue": "^2.7.0",
    "core-js": "^3.4.3",
    "vue": "^2.6.11",
    "vue-router": "^3.1.3"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^4.1.0",
    "@vue/cli-plugin-eslint": "^4.1.0",
    "@vue/cli-service": "^4.1.0",
    "babel-eslint": "^10.0.3",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "rules": {
      "no-console": "off"
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "browserslist": [
    "> 1%",`enter code here`
    "last 2 versions"
  ]
}

有人可以帮助处理此案吗?非常感谢...

我们的生产环境必须使用“ npm install --production”来安装项目,但是当遇到以下错误的触发器“ npm run serve”时:'vue-cli-service'无法识别为...

node.js npm-install vue-cli
1个回答
0
投票

serve脚本是否需要您的devDependencies?如果您运行npm install,那么npm run serve是否有效?

© www.soinside.com 2019 - 2024. All rights reserved.