vuejs2 - sh:vue-cli-service:在 aws amplify for vuejs2 应用程序的构建步骤中找不到命令
问题描述
我正在尝试在 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
是否存在于开发依赖项中。
解决方案
对我有用的快速修复是@vue/cli-service
使用此命令全局安装npm install -g @vue/cli-service
还要确保您的npm install
命令运行,NODE_ENV=development
否则devDependencies
将不会安装。
推荐阅读
- python-3.x - 在另一个函数中导入函数时出现问题
- typescript - TypeScript 错误 [TS2741] 来自 lodash 的 mapKeys(camelcase)
- java - (Windows) 为什么我会收到 UnsupportedClassVersionError 与 Java 和 JDK 最新?
- python-3.x - Python3 Glove 属性错误:“生成器”对象没有属性“形状”
- angular - providedIn:LazyModule 失败,没有提供程序错误
- javascript - 如何将带有 javascript 的对象添加到这个 json 示例中?
- python - 计算器没有给出正确的结果
- web - Google Analystics 的 Cookie 和隐私政策
- c++ - (Winsock) UDP 接收有效,但同一套接字的发送失败
- aerospike - Aerospike - 如何使用 golang 驱动程序将 BinMap 转换为 JSON