所以我刚刚在Mac上更新了NPM,它在项目上生成了一个锁定文件。 “嘿 - 这很棒”我说并承诺。然后我的构建在Travis CI上失败了:
Compiling Frontend Assets
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.4.0-83-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v7.4.0/bin/node" "/home/travis/.nvm/versions/node/v7.4.0/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! shasum check failed for /tmp/npm-9017-ad78fe01/registry.npmjs.org/hawk/-/hawk-3.1.3.tgz
npm ERR! Expected: 078444bd7c1640b0fe540d2c9b73d59678e8e1c4
npm ERR! Actual: 282a21cacac687357d149e149c408a3c0506695c
npm ERR! From: https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/travis/build/project/npm-debug.log
make: *** [frontend] Error 1
这是一个Symfony项目,但我使用NPM进行SCSS,JS编译和复制图像和字体等到web目录。我预计这可能与OSX&amp;软件包的差异有关。 Linux - 我之前使用过图像处理软件包。
或者可能是由于travis在这里使用的NPM版本?
我现在在本地机器上有5.3.0。
或者是我对npm的锁文件不了解的事情?可能是因为它正在尝试验证安装的软件包......
我的package.json
看起来像这样。问题显然是依赖于依赖。我想知道我是否应该只是.gitignore锁文件,如果它会导致这种冲突。而且我不确定我是否需要开始确保所有版本的node和npm在运行构建的所有平台上都是相同的。
{
"name": "project",
"version": "1.0.0",
"description": "project",
"main": "index.js",
"scripts": {
... front end build scripts
},
... ,
"devDependencies": {
"autoprefixer": "^7.1.2",
"bulma": "^0.5.1",
"chokidar-cli": "^1.2.0",
"cssnano": "^3.10.0",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"jshint": "^2.9.5",
"mkdirp": "^0.5.1",
"node-sass": "^4.5.3",
"npm-run-all": "^4.0.2",
"postcss-cli": "^4.1.0",
"uglifyjs-folder": "^1.1.0"
}
}