簡體   English   中英

運行 npm install 時出錯

[英]error while running npm install

運行npm install出現以下錯誤:

npm ERR! code 1
npm ERR! Command failed: /usr/bin/git checkout ~3.9.0
npm ERR! error: pathspec '~3.9.0' did not match any file(s) known to git.
npm ERR!

節點和 npm 版本:

$ node -v
v10.4.0

$ npm -v
6.1.0

我嘗試降級 npm 並在兩台不同的機器上運行它,但得到了相同的結果。

以下是 package.json 中的依賴項:

"dependencies": {
"@bower_components/jquery": "jquery/jquery-dist#3.3.1",
"@bower_components/lodash": "lodash/lodash#~3.9.0",
"autosize": "^4.0.2",
"babel-core": "^6.26.3",
"babel-jest": "^23.0.1",
"babel-loader": "^7.1.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-rewire": "^1.0.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"chai": "^4.1.2",
"chart.js": "^2.7.2",
"chartkick": "^2.3.5",
"chosen-js": "^1.8.5",
"core-js": "^2.5.7",
"create-react-class": "^15.6.3",
"del": "^3.0.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-15": "^1.0.2",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.8.2",
"event-stream": "^3.3.4",
"gulp": "^3.8.7",
"gulp-autoprefixer": "^4.0.0",
"gulp-cached": "^1.1.1",
"gulp-clean": "^0.3.0",
},
 "scripts": {
"test": "jest",
"start": "gulp dev",
"hot": "gulp hot-dev",
"build": "gulp build"
}

4.0 對我來說同樣的問題我在 package.json “gulp”中有一個依賴項:“github:gulpjs/gulp#4.0”,

我刪除了 #4.0 並且它現在可以工作了。

我回答晚了,但我的回答可能會向這里的所有訪客澄清這個問題。

Git 無法解析“指定路徑”為 3.9.0 版本的依賴項。 刪除版本 #3.9.0 將選擇最新的可用版本。 正如此處的一個答案中提到的那樣,這不一定是 gulp 的問題。 我在@bower_components/lodash": "lodash/lodash#~3.9.0" in your package.json 中看到了版本。因此,刪除#~3.9.0應該可以。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM