sh:vue cli服务:在aws amplify for vuejs2应用程序的生成步骤中未找到命令

sh:vue cli服务:在aws amplify for vuejs2应用程序的生成步骤中未找到命令,vuejs2,aws-amplify,vue-cli,Vuejs2,Aws Amplify,Vue Cli,我正在尝试在AWS amplify中部署vue应用程序 下面是我的构建配置- version: 0.1 frontend: phases: preBuild: commands: - npm install build: commands: - npm run production artifacts: baseDirectory: dist files: - '**/*' cache

我正在尝试在AWS amplify中部署vue应用程序

下面是我的构建配置-

version: 0.1
frontend:
  phases:
    preBuild:
      commands:
        - npm install
    build:
      commands:
        - npm run production
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
vue应用程序中的My package.json-

{
    "name": "foobar",
    "version": "0.1.0",
    "private": true,
    "scripts": {
        "start": "./bin/web.js",
        "serve": "vue-cli-service serve --mode development",
        "production": "vue-cli-service build --mode production",
        "sandbox": "vue-cli-service build --mode sandbox",
        "lint": "vue-cli-service lint"
    },
    "dependencies": {
        "axios": "^0.18.0",
        "bignumber.js": "^8.0.1",
        "bootstrap": "^4.3.1",
        "connect-history-api-fallback": "^1.5.0",
        "cors": "^2.8.5",
        "currency-formatter": "^1.5.3",
        "ethereum-blockies": "^0.1.1",
        "ethereum-blockies-base64": "^1.0.2",
        "express": "^4.16.4",
        "from-now": "^1.0.2",
        "jquery": "^3.3.1",
        "lodash": "^4.17.11",
        "moment": "^2.22.2",
        "popper.js": "^1.14.7",
        "socket.io-client": "^2.3.0",
        "vue": "^2.5.17",
        "vue-axios": "^2.1.4",
        "vue-multiselect": "^2.1.4",
        "vue-router": "^3.0.1",
        "vuejs-paginate": "^2.1.0",
        "vuex": "^3.0.1"
    },
    "devDependencies": {
        "@vue/cli-plugin-babel": "^3.2.0",
        "@vue/cli-plugin-eslint": "^3.2.0",
        "@vue/cli-plugin-unit-mocha": "^3.2.0",
        "@vue/cli-service": "^3.2.0",
        "@vue/test-utils": "^1.0.0-beta.20",
        "babel-eslint": "^10.0.1",
        "chai": "^4.1.2",
        "eslint": "^5.8.0",
        "eslint-plugin-vue": "^5.0.0-0",
        "node-sass": "^4.11.0",
        "sass-loader": "^7.1.0",
        "vue-cli-plugin-bootstrap": "^1.0.0-alpha.1",
        "vue-template-compiler": "^2.5.17"
    }
}
在构建步骤中,它失败了,所以我打开日志,看到了以下错误-

2020-03-25T06:37:48.522Z[警告]:sh:vue cli服务:命令不可用 发现


为什么会出错<代码>vue cli服务位于开发依赖项中。

您可能希望使用
npm ci
或丢弃
节点\u模块
,至少一次作为测试。似乎大多数遇到此问题的CICD系统都是通过销毁node_modules工件来解决的:

一个对我有效的快速修复方法是使用此命令在全局范围内安装
@vue/cli service

还要确保您的
npm install
命令在
NODE\u ENV=development
中运行,否则将不会安装
devDependencies