我正在使用nodejs和' Jenkins'现在每天都在过去几个月。 不对我的package.json进行任何更改。在' jenkins'建立我的项目我收到以下错误 -
gifsicle@3.0.4 postinstall /var/lib/jenkins/workspace/musichords/public/node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node lib/install.js
module.js:338
throw err;
^
Error: Cannot find module '@gulp-sourcemaps/map-sources'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/var/lib/jenkins/workspace/musichords/public/node_modules/vinyl-fs/node_modules/gulp-sourcemaps/index.js:6:15)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
npm WARN optional dep failed, continuing imagemin-optipng@4.3.0
npm WARN optional dep failed, continuing imagemin-jpegtran@4.3.2
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.9/bin/node" "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.9/bin/npm" "install"
npm ERR! node v0.12.9
npm ERR! npm v2.14.9
npm ERR! code E403
npm ERR! user developers is not allowed to access package @gulp-sourcemaps/map-sources : @gulp-sourcemaps/map-sources
npm ERR!
我已经运行了npm更新,删除并重新安装了npm,安装了&gulp-sourcemaps&#39;还有一些依赖。似乎没什么用。
我的依赖关系&#39; package.json&#39; -
"dependencies": {
"acorn": "^5.0.0",
"async": "^1.5.1",
"aws-sdk": "^2.2.26",
"blueimp-md5": "^2.1.0",
"bytes": "^2.2.0",
"cheerio": "^0.20.0",
"collections": "^3.0.0",
"convert-source-map": "^1.5.0",
"cors": "^2.7.1",
"csv": "^0.4.6",
"css": "^2.2.1",
"extend": "^3.0.0",
"detect-newline": "^2.1.0",
"debug-fabulous": "^0.0.4",
"geoip-lite-youtab": "*",
"glob": "^7.0.0",
"grunt-contrib-imagemin": "^1.0.1",
"gulp": "^3.9.1",
"gulp-sourcemap": "^1.0.1",
"imagemin": "^5.2.0",
"imagemin-gifsicle": "^5.0.0",
"imagemin-jpegtran":"^5.0.0",
"imagemin-optipng":"^5.0.0",
"jade": "^1.11.0",
"jstransformer-clean-css": "^1.1.0",
"jstransformer-uglify-js": "^1.1.1",
"jstransformer-verbatim": "1.0.0",
"lru-cache": "^4.0.0",
"moment": "^2.11.0",
"needle": "^1.0.0",
"neo4j": "2.0.0-RC2",
"newrelic": "^1.24.1",
"node-genres": "*",
"optipng-bin": "^3.1.2",
"paypal-rest-sdk": "^1.7.1",
"source-map": "^0.5.6",
"string": "^3.3.1",
"text-encoding": "^0.6.1",
"underscore": "^1.8.3",
"underscore.string": "^3.2.2",
"winston": "^2.1.1",
"ytf-node-framework": "*",
"ytf-server": "*",
"ytf-server-commons": "*"
},
"devDependencies": {
"chai": "^3.4.1",
"grunt": "^0.4.5",
"grunt-contrib-clean": "~1.0.0",
"grunt-contrib-copy": "~0.8.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-shell": "^1.1.2",
"mocha": "^2.3.4",
"spec-xunit-file": "^0.0.1-3",
"superagent-no-cache": "^0.1.0",
"supertest": "^1.1.0",
"tizi": "*"
}
感谢我能找到的任何帮助。
答案 0 :(得分:3)
我能够通过明确地将该范围的注册表设置为npmjs注册表来解决此问题。
npm config set @gulp-sourcemaps:registry https://registry.npmjs.org/
https://docs.npmjs.com/misc/scope
我相信更新.npmrc文件以包含它也可以:
@gulp-sourcemaps:registry=https://registry.npmjs.org
答案 1 :(得分:2)
我们也遇到了旧的npm版本,但即使升级到4.4.4也无济于事。删除^为我们工作。
答案 2 :(得分:1)
今天早上我用自己的构建遇到了同样的问题。 gulp-sourcemaps
的作者似乎在其package.json
scoped dependency中添加了two days ago。我不熟悉范围内的依赖关系,但似乎导致npm install
失败的原因。我使用的是较旧版本的npm,它不支持范围内的依赖关系,但看起来你似乎是在更新的版本上 - 可能是他们还没有发布依赖关系,或者将其设置为public,因为作用域依赖项默认为private。
作为短期修复,您可以按照我的方式执行,并从您自己的^
中的gulp-sourcemaps
版本说明符中删除package.json
,这样可以避免提取最新版本具有新范围依赖关系的gulp-sourcemaps
版本。