我使用 gitlab CI 部署 vuejs 应用程序。对于分期,一切都很好。我复制粘贴相同的生产配置,我有:
$ npm run build
> cross-env NODE_ENV=production && vue-cli-service build
sh: 1: cross-env: not found
这是 .yml 文件:
build-prod:
stage: build-prod
image: node:latest
variables:
NODE_ENV: production
rules:
# only run on master builds, we'll deal with branch builds next
- if: '$CI_COMMIT_BRANCH == "main"'
when: on_success
- when: never
script:
- node --version
- npm --version
- ls
- cd front
- ls
- npm install -g @vue/cli-service@latest
- rm -rf node_modules
- npm install
- npm install cross-env
- npm run build <----------------------------------- Error here
- ls
我也尝试在 gitlab 上手动清理缓存,但没有效果。
分期步骤完全相同,一切正常,我该如何处理?