我正在尝试使用无人机 ci 构建我的测试容器,但在尝试安装 websocket.io 时总是失败
出现错误,我npm install -g node-gyp
按照建议添加,但问题仍然存在
npm info lifecycle compression@1.6.2~install: compression@1.6.2
npm info lifecycle express@4.14.0~install: express@4.14.0
npm info lifecycle nodeadmin@0.1.2~install: nodeadmin@0.1.2
npm info lifecycle vizion@0.2.13~install: vizion@0.2.13
npm info lifecycle websocket@1.0.24~install: websocket@1.0.24\
websocket@1.0.24 install /drone/src/bitbucket.org/xxxx/xxxxxxx/node_modules/websocket
(node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory '/drone/src/bitbucket.org/xxxxxx/xxxx/node_modules/websocket/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
这是我的 package.json
{
"name": "calm-cell",
"version": "1.0.0",
"description": "th backend app",
"scripts": {
"start": "node server.js",
"setup":"./node_modules/.bin/mocha 'test/setupDb.js' --reporter spec --timeout 3000",
"test": "./node_modules/.bin/mocha 'test/appTest.js' --reporter spec --timeout 3000",
"test:client": "karma start --single-run",
"test:server": "mocha --recursive"
},
"dependencies": {
"async": "^1.5.2",
"bcrypt-nodejs": "^0.0.3",
"bluebird": "^3.4.1",
"body-parser": "^1.15.1",
"bookshelf": "^0.9.2",
"compression": "^1.6.2",
"cookie-parser": "^1.4.1",
"dotenv": "^2.0.0",
"express": "^4.13.4",
"express-validator": "^2.20.4",
"json-2-csv": "^2.0.22",
"json2csv": "^3.6.2",
"jsonwebtoken": "^5.7.0",
"jwt-decode": "^2.1.0",
"jwt-then": "^0.4.1",
"knex": "^0.10.0",
"loadtest": "^1.4.4",
"mkdirp": "^0.5.1",
"moment": "^2.12.0",
"morgan": "^1.7.0",
"mysql": "^2.10.2",
"node-uuid": "^1.4.7",
"nodeadmin": "^0.1.2",
"nodemailer": "^2.5.0",
"opbeat": "^3.16.0",
"pdf-invoice": "^1.0.2",
"pm2": "^1.1.3",
"pmx": "^0.6.3",
"request": "^2.69.0"
},
"devDependencies": {
"chai": "^3.5.0",
"chai-http": "^3.0.0",
"karma": "^0.13.22",
"karma-chai": "^0.1.0",
"karma-coverage": "^0.5.5",
"karma-mocha": "^1.0.1",
"mocha": "^2.5.3",
"nodeman": "^1.1.2",
"mocha-junit-reporter": "^1.12.1",
"sinon": "^1.17.3",
"sinon-chai": "^2.8.0",
"supertest": "^1.2.0"
},
"engines": {
"node": "6.1.0"
}
}
这是无人机 yml 文件
build:
image: node:boron
commands:
- npm install -g node-gyp
- npm update # Update your personal npm local repository again.
- npm install
- npm run setup
- npm run test
environment:
- EXAM_SERVER_URL=http://S8.dummy.com
- FETCH_SERVER_FETCH_API='/getSomething?something='
- TOKEN_SECRET=superSecretFakeToken
- DB_HOST=localhost
- DB_USER=root
- DB_PASSWORD=thisIsFakePassword
- DB_NAME=thisIsFakeDB
compose:
database:
image: mysql:5.6
environment:
- MYSQL_ROOT_PASSWORD=thisIsFakePassword
- MYSQL_DATABASE=thisIsFakeDB