我正在我的 bitbucket 管道中运行
quasar build
,但输出是:错误未知命令“build”
有人知道为什么会发生这种情况吗?我基本上只想推送我的代码,让 bitbucket 管道处理其余的事情。
image: node:10.15.3
pipelines:
branches:
master:
- step:
name: Building Quasar
caches:
- node
script:
- yarn global add @quasar/cli
- quasar build
- do some other stuff
artifacts:
- path/to/artifact
- step:
name: Deploying to S3
caches:
- node
script:
- cp $BITBUCKET_CLONE_DIR/path/to/artifact path/to/artifact
- pipe: atlassian/aws-s3-deploy:0.3.8
variables:
...
这是使用包管理器获取包时常见的错误。默认情况下,如果 NODE_ENV 设置为生产,yarn 包管理器不会获取开发依赖项。 您有 3 个解决方案:
来自 https://forum.quasar-framework.org/topic/5283/unknown-command-build-circleci/5
run: npm install && npm install --only=dev
在我的例子中固定执行如下:
npm install && npm install --only=dev
npm install @quasar/cli
npx quasar build
如果该项目的 node_modules 没有更新,则可能会发生这种情况。运行“npm install”或相当于yarn的命令。下面是我此时项目的 package.json 的快照。
"dependencies": {
"@quasar/extras": "^1.0.0",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"quasar": "^2.0.0",
"vue-i18n": "^9.0.0",
"vuex": "^4.0.1"
},
"devDependencies": {
"@babel/eslint-parser": "^7.13.14",
"@quasar/app": "^3.0.0",
"@types/node": "^12.20.21",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
"eslint": "^7.14.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-vue": "^7.0.0",
"workbox-webpack-plugin": "^6.4.2"
}
我在更新我的 Quasar 项目(并迁移到 Vite)后遇到了这个问题。我的
@quasar/cli
实用程序是全局安装的,因此它没有与 Yarn 管理的其余包一起更新。解决方案很简单:
npm update -g @quasar/cli
我发现你的管道中缺少一些东西:
pipelines:
branches:
master:
- step:
name: Building Quasar
caches:
- node
script:
- yarn global add @quasar/cli
- yarn install --frozen-lockfile # close to `npm ci` required before start building
- quasar build
- cd dist/ssr # or any other folder in the dist
- yarn install --production # now install the dependencies for the built application before deployment
- do some other stuff
artifacts:
- path/to/artifact