node.js - npm 错误!尝试安装 package.json 时,git dep 准备失败

标签 node.js angularjs git npm npm-install

我正在尝试使用命令 npm install 安装 package.json 文件,但出现以下错误。

npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\Users\DHRUV\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\DHRUV\AppData\Local\npm-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!
我已经安装了 Git 和 Node 。
包.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"
  }
}

最佳答案

试试这个
第1步:

$ npm cache clean --force
第2步:
通过 node_modules 删除 $ rm -rf node_modules 也删除 package-lock.json第 3 步:
更新 npm 到最新的稳定版本
npm install -g npm@7.6.0
第 3 步:
npm install
重新开始,
$ npm start

关于node.js - npm 错误!尝试安装 package.json 时,git dep 准备失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66434750/

相关文章:

json - 带有查询字符串的 POST 嵌套对象

javascript - 如何在 native react 中将图像发送到后端?

javascript - 如何从 Angularjs 中的指令事件强制更新 View

git - 在 shell 上找到 git hooks 目录的路径

Git 工作流问题 - 压缩提交和冲突

node.js - 尝试安装 mongoose 时出错

node.js - 如何在 NodeJS 应用程序中将远程端口转发到本地端口

angularjs - 从 Protractor 激活时激活 chrome 语言标志(selenium)

javascript - iframe src 函数调用不断被触发

GitHub 提示 "Force pushing can corrupt your pull request."为什么?