【发布时间】:2018-09-13 14:57:44
【问题描述】:
如何解决这个错误?我已将 CircleCI 更新到 2.0,现在无法运行测试。
> npm test
sh: 1: npm: Permission denied
如何使用sudo 或其他内容?
circle.yml
machine:
node:
version: 8.9.1
dependencies:
pre:
- sudo sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
- sudo apt update
- sudo apt-get install python2.7-dev
- sudo easy_install --upgrade six
- sudo pip install --upgrade urllib3==1.21.1
- sudo pip install --upgrade pip
- sudo pip install --upgrade blessed
- sudo pip install awsebcli==3.12.3 --ignore-installed six pyyaml
deployment:
production:
branch: production
commands:
- bash ./deploy_prod.sh
- eb deploy stmi-production
staging:
branch: master
commands:
- bash ./deploy_staging.sh
- eb deploy stmi-dev
config.yml
版本:2
jobs:
build:
working_directory: ~/systemsthinkinginstitute/stmi-test-web
parallelism: 1
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
docker:
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
command: /sbin/init
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- run:
working_directory: ~/systemsthinkinginstitute/stmi-test-web
command: nvm install 8.9.1 && nvm alias default 8.9.1
- restore_cache:
keys:
- v1-dep-{{ .Branch }}-
- v1-dep-master-
- v1-dep-
- run: sudo sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
- run: sudo apt update
- run: sudo apt-get install python2.7-dev
- run: sudo easy_install --upgrade six
- run: sudo pip install --upgrade urllib3==1.21.1
- run: sudo pip install --upgrade pip
- run: sudo pip install --upgrade blessed
- run: sudo pip install awsebcli==3.12.3 --ignore-installed six pyyaml
- run: rm -rf /home/ubuntu/.aws
- run: if [ -z "${NODE_ENV:-}" ]; then export NODE_ENV=test; fi
- run: export PATH="~/systemsthinkinginstitute/stmi-test-web/node_modules/.bin:$PATH"
- run: npm install
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
paths:
- vendor/bundle
- ~/virtualenvs
- ~/.m2
- ~/.ivy2
- ~/.bundle
- ~/.go_workspace
- ~/.gradle
- ~/.cache/bower
- ./node_modules
- run: npm test
- store_test_results:
path: /tmp/circleci-test-results
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
【问题讨论】:
-
我们可以看到您的
config.yml已编辑到您的问题中,格式是否正确? -
请同时删除您帖子中的图片,并将其替换为等效文本。图像中的文本与剪贴板、屏幕阅读器和搜索引擎不兼容,如果您可以使用文本代替,那可能会帮助您的读者帮助您。
-
你使用的是什么 Docker 镜像?
-
@halfer,我更新了问题
-
好的,好多了,但是我在你的 YAML 配置中看不到
better-npm-run?