为什么Travis CI在npm安装期间无法创建目录?

时间:2016-02-02 23:07:21

标签: node.js npm travis-ci

我最近的提交在某种程度上导致Travis CI在尝试运行npm install时停止工作。我唯一的改变是更正了一个调用Javascript文件的拼写错误(从fooBar/foo-bar.jsfoo-bar/foo-bar.js),所以我不确定提交本身是否是原因。我从Travis CI收到的错误如下:

bower                                               EACCES EACCES, mkdir '/public'

Stack trace:
Error: EACCES, mkdir '/public'
    at Error (native)

Console trace:
Error
    at StandardRenderer.error (/home/travis/build/myWorkplace/mySite/node_modules/bower/lib/renderers/StandardRenderer.js:83:37)
    at Logger.<anonymous> (/home/travis/build/myWorkplace/mySite/node_modules/bower/lib/bin/bower.js:110:26)
    at Logger.emit (events.js:107:17)
    at Logger.emit (/home/travis/build/myWorkplace/mySite/node_modules/bower/lib/node_modules/bower-logger/lib/Logger.js:29:39)
    at /home/travis/build/myWorkplace/mySite/node_modules/bower/lib/commands/index.js:48:20
    at _rejected (/home/travis/build/myWorkplace/mySite/node_modules/bower/lib/node_modules/q/q.js:844:24)
    at /home/travis/build/myWorkplace/mySite/node_modules/bower/lib/node_modules/q/q.js:870:30
    at Promise.when (/home/travis/build/myWorkplace/mySite/node_modules/bower/lib/node_modules/q/q.js:1122:31)
    at Promise.promise.promiseDispatch (/home/travis/build/myWorkplace/mySite/node_modules/bower/lib/node_modules/q/q.js:788:41)
    at /home/travis/build/myWorkplace/mySite/node_modules/bower/lib/node_modules/q/q.js:604:44
System info:
Bower version: 1.7.7
Node version: 0.12.2
OS: Linux 3.13.0-40-generic x64

不幸的是,Travis CI是由承包商为我们设置的,所以我不知道还有哪些信息可以提供,但是如果有更多信息可以提供帮助,我会很乐意找到它。

编辑:
查看日志以获得成功运行,看起来mkdir行对于此构建来说是新的...

EDIT2: 以下是我的.travis.ymlbower.json

.travis.yml

language: node_js
node_js:
- 0.12.2
services:
- mongodb
before_install: npm install -g grunt-cli
install: npm install
before_script: grunt && grunt --target=admin
env:
  global:
  - NODE_ENV: test
  - PORT: 5000
  - SSL: "off"
  - TOKEN_SECRET: [xxx]
  - MONGO_URI: mongodb://localhost:27017/myWorkplace-test
  - BUCKET: myWorkplacebucket
  - AWS_REGION: us-west-2
  - CDN: https://[xxx].cloudfront.net
  - POSTMARK_API_KEY: POSTMARK_API_TEST
  - MAIL_FROM_NAME: myWorkplace
  - MAIL_FROM_EMAIL: user@myWorkplace.com
  - AIRBRAKE: [xxx]
  - secure: [xxx]
  - secure: [xxx]
deploy:
  - provider: s3
    access_key_id: [xxx]
    secret_access_key:
      secure: [xxx]
    bucket: "myWorkplace-builds"
    skip_cleanup: true
    region: us-west-2
    local_dir: dist
    on:
      branch: master
  - provider: s3
    access_key_id: [xxx]
    secret_access_key:
      secure: [xxx]
    bucket: "myWorkplace-builds-dev"
    skip_cleanup: true
    region: us-west-2
    local_dir: dist
    on:
      branch: dev
  - provider: codedeploy
    access_key_id: [xxx]
    secret_access_key:
      secure: [xxx]
    revision_type: github
    region: us-west-2
    application: mySite
    deployment_group: devs
    on:
      branch: dev
  - provider: codedeploy
    access_key_id: [xxx]
    secret_access_key:
      secure: [xxx]
    revision_type: github
    region: us-west-2
    application: mySite
    deployment_group: production
    on:
      branch: master
notifications:
  slack: myWorkplace:[xxx]

bower.json

{
  "name": "myWorkplace",
  "version": "0.0.1",
  "authors": [
    "Foo User <user@myWorkplace.com>"
  ],
  "license": "MIT",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "angular": "1.3.11",
    "jquery": "2.1.2",
    "angular-route": "1.3.11",
    "angular-resource": "1.3.11",
    "angular-animate": "1.3.11",
    "angular-mocks": "1.3.11",
    "less": "2.5.1",
    "bootstrap": "3.3.2",
    "angular-bootstrap": "0.12.1",
    "moment": "2.8.3",
    "html5-boilerplate": "4.3.0",
    "lodash": "3.1.0",
    "angular-bootstrap-show-errors": "2.0.0",
    "autofill-event": "1.0.0",
    "angular-ui-router": "0.2.11",
    "ngInfiniteScroll": "1.0.0",
    "angular-file-upload": "1.1.5",
    "d3": "3.3.10",
    "iso-currency": "~0.2.1",
    "angular-moment": "0.8.2",
    "angular-filter": "0.5.1",
    "angular-busy": "~4.1.2",
    "angular-csv-import": "0.0.14",
    "angulartics": "0.17.2",
    "angular-toggle-switch": "1.0.0",
    "ng-idle": "1.0.0",
    "iso-4217-currency-codes-angular": "~1.0.1"
  },
  "resolutions": {
    "angular": "1.3.11",
    "d3": "3.5.5"
  }
}

EDIT3:我重新开始之前成功的Travis构建,并且失败并出现同样的错误。这使我认为对模块的某种更新使它不再起作用。我不确定。值得注意的是,也许有些行说graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.我不知道如何更新它,因为graceful-fs不在package.json中,而是提交到存储库...

1 个答案:

答案 0 :(得分:1)

原因是该问题的根本原因是一个已更新且不再在我的环境中工作的软件包。我通过将package.json中的所有版本锁定到我之前认识的版本来修复它。