我尝试npm install在全新安装Node和Git后运行时收到以下错误
任何人都知道可能导致它的原因,以及如何解决这个问题?
package.json (删除公司详情)
{
"name": "xxx",
"version": "1.0.0",
"description": "xxx",
"engines": {
"node": "5.0.0",
"npm": "3.3.9"
},
"repository": "xxx",
"private": true,
"license": "UNLICENSED",
"dependencies": {
"dijit": "https://github.com/dojo/dijit.git#1.10.4",
"dojo": "1.10.4",
"fg-dialog": "0.1.5",
"politespace": "0.1.4",
"shoestring": "1.0.3"
},
"devDependencies": {
"body-parser": "^1.14.1",
"chalk": "^1.1.1",
"compression": "^1.6.0",
"del": "^2.0.2",
"dojo-util": "https://github.com/dojo/util.git#1.10.4",
"express": "^4.13.3",
"glob": "^5.0.15",
"gulp": "^3.9.0",
"gulp-concat": "^2.6.0",
"gulp-git": "^1.6.0",
"gulp-html-minifier": "^0.1.6",
"gulp-jsbeautifier": "^1.0.1",
"gulp-jshint": "^1.11.2",
"gulp-jshint-xml-file-reporter": "^0.5.1",
"gulp-jsonminify": "^1.0.0",
"gulp-replace": "^0.5.4",
"gulp-task-listing": "^1.0.1",
"gulp-uglify": "^1.4.1",
"gulp-util": "^3.0.6",
"gulp-zip": "^3.0.2",
"intern": "https://github.com/theintern/intern.git",
"jshint-stylish": "^2.0.1",
"merge-stream": "^1.0.0",
"minimist": "^1.2.0",
"open": "^0.0.5",
"q": "^1.4.1",
"request": "^2.65.0",
"require-dir": "^0.3.0",
"run-sequence": "^1.1.2",
"selenium-standalone": "^4.6.3"
},
"scripts": {
"postinstall": "gulp install"
}
}
Run Code Online (Sandbox Code Playgroud)
Mar*_*erg 14
建议的第一步是使用最新的npm:
npm install -g npm
Run Code Online (Sandbox Code Playgroud)
(你可能需要sudo).你使用的是npm 2.x,最新的是3.5.x.
就我而言,我刚刚升级了 npm 并且 package-lock.json 试图从不可用的 git commit 版本安装项目的包之一。
删除并让 npm 重新创建文件 package-lock.json 解决了该问题。
rm package-lock.json
Run Code Online (Sandbox Code Playgroud)
注意:看起来 package-lock.json 维护了更多关于 node_modules 树的细节,所以在一个复杂/版本特定的项目中,隔离导致问题的特定行可能很重要,而不是仅仅删除包锁。 .json 文件。
https://docs.npmjs.com/files/package-lock.json
小智 6
该错误指向修订,特别是 1.10.4 的使用。检查 dijit.git 和 util.git 的 BitBucket 存储库是否已设置标记。有关 Atlassian 版本控制/标记的更多信息:https://confluence.atlassian.com/bitbucket/use-repo-tags-321860179.html。
如果您使用已保存密码的 SSH,则对您的个人存储库的引用将需要使用以下格式通过 SSH 连接。
git+ssh://git@bitbucket.org/{user}/{repository}.git
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
39425 次 |
| 最近记录: |