Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.3k views
in Technique[技术] by (71.8m points)

node.js - npm ERR! git dep preparation failed when trying to install package.json

I'm trying to install package.json file using the command npm install, but I'm getting the following error.

npm ERR! git dep preparation failed
npm ERR! command C:Program Files
odejs
ode.exe C:UsersDHRUVAppDataRoaming
pm
ode_modules
pmin
pm-cli.js install --force --cache=C:UsersDHRUVAppDataLocal
pm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 128
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command git ls-remote ssh://git@github.com/gulpjs/gulp.git
npm ERR! npm ERR! Host key verification failed.
npm ERR! npm ERR! fatal: Could not read from remote repository.
npm ERR! npm ERR!
npm ERR! npm ERR! Please make sure you have the correct access rights
npm ERR! npm ERR! and the repository exists.
npm ERR!

I have installed Git and node.

package.json:

{
  "name": "LandTransfer",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test --watch=false",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "node patch.js"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "7.1.0",
    "@angular/cdk": "^7.1.0",
    "@angular/common": "7.1.0",
    "@angular/compiler": "7.1.0",
    "@angular/core": "7.1.0",
    "@angular/forms": "7.1.0",
    "@angular/http": "7.1.0",
    "@angular/material": "^7.1.0",
    "@angular/platform-browser": "7.1.0",
    "@angular/platform-browser-dynamic": "7.1.0",
    "@angular/platform-server": "7.1.0",
    "@angular/router": "7.1.0",
    "bootstrap": "^4.3.1",
    "core-js": "^2.5.7",
    "ethers": "^4.0.20",
    "rxjs": "^6.3.3",
    "truffle-contract": "^4.0.1",
    "tslib": "^1.9.0",
    "typedarray-to-buffer": "^3.1.5",
    "web3": "1.0.0-beta.37",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.12.1",
    "@angular-devkit/core": "0.8.1",
    "@angular/cli": "^7.1.0",
    "@angular/compiler-cli": "7.1.0",
    "@angular/language-service": "7.1.0",
    "@types/jasmine": "^2.8.12",
    "@types/jasminewd2": "^2.0.6",
    "@types/node": "^6.14.2",
    "codelyzer": "^4.4.4",
    "jasmine-core": "^2.99.1",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^3.1.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "^1.0.1",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.1",
    "protractor-console-plugin": "^0.1.1",
    "ts-node": "^3.3.0",
    "tslint": "^5.11.0",
    "typescript": "3.1.6",
    "webpack": "^4.26.1",
    "webpack-dev-server": "^3.1.10"
  }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try this

Step 1:

$ npm cache clean --force

Step 2:

Delete node_modules by $ rm -rf node_modules also delete package-lock.json

Step 3:

Update the npm to the latest stable version

npm install -g npm@7.6.0

Step 3:

npm install

To start again,

$ npm start

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...