简体   繁体   English

npm 安装失败并显示“git dep 准备失败”

[英]npm install failing with "git dep preparation failed"

I am new to node and npm and am trying to setup my system with node and npm so that I can run a local project.我是 node 和 npm 的新手,我正在尝试使用 node 和 npm 设置我的系统,以便我可以运行本地项目。 After installing the latest version of node and npm, when I run the command npm install --legacy-peer-deps , I see the following error:安装最新版本的 node 和 npm 后,当我运行命令npm install --legacy-peer-deps时,我看到以下错误:

npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /Users/<username>/.nvm/versions/node/v14.17.6/bin/node /Users/<username>/.nvm/versions/node/v14.17.6/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/<username>/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > @types/ramda@0.25.0 prepublish
npm ERR! > yarn run build
npm ERR!
npm ERR! yarn run v1.19.1
npm ERR! $ gulp build
npm ERR! [08:21:10] Requiring external module ts-node/register
npm ERR! info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN deprecated core-js@2.5.0: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! gulp[17622]: ../src/node_contextify.cc:681:static void node::contextify::ContextifyScript::New(const FunctionCallbackInfo<v8::Value> &): Assertion `args[1]->IsString()' failed.
npm ERR!  1: 0x101306bb5 node::Abort() (.cold.1) [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR!  2: 0x1000ad6c9 node::Abort() [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR!  3: 0x1000ad531 node::Assert(node::AssertionInfo const&) [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR!  4: 0x1000a0d14 node::contextify::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR!  5: 0x1002624a8 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR!  6: 0x10026175c v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR!  7: 0x10026117f v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR!  8: 0x100a7c4d9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR!  9: 0x100a11401 Builtins_JSBuiltinsConstructStub [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR! 10: 0x100afa783 Builtins_ConstructHandler [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR! 11: 0x100a15282 Builtins_InterpreterEntryTrampoline [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR! 12: 0x100a15282 Builtins_InterpreterEntryTrampoline [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR! 13: 0x100a15282 Builtins_InterpreterEntryTrampoline [/Users/<username>/.nvm/versions/node/v14.17.6/bin/node]
npm ERR! error Command failed with signal "SIGABRT".
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /Users/<username>/.npm/_cacache/tmp/git-cloneAPu0nz
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c yarn run build
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/<username>/.npm/_logs/2021-09-07T15_21_10_861Z-debug.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/<username>/.npm/_logs/2021-09-07T15_21_29_362Z-debug.log

node -v ==> v14.17.6节点-v ==> v14.17.6
npm -v ==> 7.22.0 npm -v ==> 7.22.0
I ran npm cache clean -f and tried npm install --force but still run into the same error.我运行npm cache clean -f并尝试了npm install --force但仍然遇到相同的错误。 Can anyone help me figure out what this error is and what I can try to do to resolve it?谁能帮我弄清楚这个错误是什么以及我可以尝试做些什么来解决它? I did try the steps mentioned in this previous answer but it did not help me.我确实尝试了上一个答案中提到的步骤,但它对我没有帮助。

Contents of package.json package.json的内容

{
  "name": "jit-ui",
  "version": "0.0.1",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build-prod": "ng build --prod --source-map",
    "build-dev": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^12.2.4",
    "@angular/cdk": "^12.2.4",
    "@angular/common": "~12.2.4",
    "@angular/compiler": "~12.2.4",
    "@angular/core": "~12.2.4",
    "@angular/flex-layout": "^12.0.0-beta.34",
    "@angular/forms": "~12.2.4",
    "@angular/material": "^12.2.4",
    "@angular/platform-browser": "~12.2.4",
    "@angular/platform-browser-dynamic": "~12.2.4",
    "@angular/router": "^12.2.4",
    "@uirouter/angular": "^8.0.1",
    "core-js": "^3.17.2",
    "hammerjs": "^2.0.8",
    "moment": "^2.29.1",
    "ngx-perfect-scrollbar": "^10.1.1",
    "ramda": "^0.27.1",
    "rxjs": "~7.3.0",
    "rxjs-compat": "^6.6.7",
    "tslib": "^2.3.1",
    "zone.js": "^0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^12.2.4",
    "@angular-devkit/core": "~12.2.4",
    "@angular/cli": "~12.2.4",
    "@angular/compiler-cli": "~12.2.4",
    "@angular/language-service": "~12.2.4",
    "@types/jasmine": "^3.9.0",
    "@types/jasminewd2": "~2.0.10",
    "@types/node": "~16.7.13",
    "@types/ramda": "github:types/npm-ramda",
    "codelyzer": "~6.0.2",
    "jasmine-core": "~3.9.0",
    "jasmine-spec-reporter": "~7.0.0",
    "karma": "~6.3.4",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "^3.0.3",
    "karma-jasmine": "~4.0.1",
    "karma-jasmine-html-reporter": "^1.7.0",
    "prettier": "^2.3.2",
    "protractor": "^7.0.0",
    "ts-node": "~10.2.1",
    "tslint": "~5.20.1",
    "typescript": "~4.4"
  }
}

解决方案:只需将节点版本降级到像 v12.18.0 这样的旧版本,这对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM