sh:vue-cli-service:在vuejs2应用程序的aws放大的构建步骤中找不到命令

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

我正在尝试在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应用程序中的我的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-service:命令未找到

为什么出错?开发人员依赖项中有vue-cli-service

vuejs2 aws-amplify vue-cli
1个回答
0
投票

您可能至少要一次使用npm ci或将您的node_modules当作垃圾进行测试。似乎大多数CICD系统都遇到了此问题,可以通过销毁node_modules工件来解决:https://github.com/vuejs/vue-cli/issues/2404

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