[为什么在macOS Catalina上为Angular项目运行npm install时出现这些故障?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[为什么在macOS Catalina上为Angular项目运行npm install时出现这些故障?相关的知识,希望对你有一定的参考价值。
我有一个现有的角度项目,该项目仅在几个月前开始工作,并已登录到git repo。我有一台运行Catalina的新Macbook,并在全球范围内安装了node和angular cli。从git repo克隆项目后,我运行了'npm install',安装失败。有人可以帮我解决这个问题吗?似乎深入到了角度和节点,对此我有点陌生。这是输出:
user@mbp (master)-> npm install
> grpc@1.23.3 install /Users/username/Development/angular/idea-portal/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.23.3/node-v79-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for grpc@1.23.3 and node@13.6.0 (node-v79 ABI, unknown) (falling back to source compile with node-gyp)
CXX(target)Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver_registry.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver_result_parsing.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/resolving_lb_policy.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/retry_throttle.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/server_address.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/service_config.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/subchannel.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/subchannel_pool_interface.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/deadline/deadline_filter.o
CC(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/health/health.pb.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/tsi/fake_transport_security.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/tsi/local_transport_security.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/tsi/ssl/session_cache/ssl_session_boringssl.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/tsi/ssl/session_cache/ssl_session_cache.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/tsi/ssl/session_cache/ssl_session_openssl.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/tsi/ssl_transport_security.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/tsi/transport_security_grpc.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/server/chttp2_server.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/client/secure/secure_channel_create.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/server/insecure/server_chttp2.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/inproc/inproc_plugin.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/transport/inproc/inproc_transport.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.o
CC(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.o
CC(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.o
CC(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.o
CXX(target)Release/obj.target/grpc/deps/grpc/src/core/ext/filters/message_size/message_size_filter.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/http/client_authority_filter.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/workarounds/workaround_utils.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/plugin_registry/grpc_plugin_registry.o
LIBTOOL-STATIC Release/libgrpc.a
CXX(target) Release/obj.target/gpr/deps/grpc/src/core/lib/gpr/alloc.o
CXX(target) Release/obj.target/gpr/deps/grpc/src/core/lib/gpr/atm.o
CXX(target) Release/obj.target/gpr/deps/grpc/src/core/lib/gpr/cpu_iphone.o
Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_parse_txt_reply.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_platform.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_process.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_query.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_search.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_send.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_strcasecmp.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_strdup.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_strerror.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_strsplit.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_timeout.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_version.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/ares_writev.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/bitncmp.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/inet_net_pton.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/inet_ntop.o
CC(target) Release/obj.target/ares/deps/grpc/third_party/cares/cares/windows_port.o
LIBTOOL-STATIC Release/libares.a
CC(target) Release/obj.target/address_sorting/deps/grpc/third_party/address_sorting/address_sorting.o
CC(target) Release/obj.target/address_sorting/deps/grpc/third_party/address_sorting/address_sorting_posix.o
CC(target) Release/obj.target/address_sorting/deps/grpc/third_party/address_sorting/address_sorting_windows.o
LIBTOOL-STATIC Release/libaddress_sorting.a
CXX(target) Release/obj.target/grpc_node/ext/byte_buffer.o
CXX(target) Release/obj.target/grpc_node/ext/call.o
../ext/call.cc:104:53: error: no matching member function for call to 'Get'
Local<String> current_key(Nan::To<String>(keys->Get(i)).ToLocalChecked());
~~~~~~^~~
/Users/username/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
/Users/username/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
../ext/call.cc:681:27: error: no matching member function for call to 'Get'
if (!op->ParseOp(obj->Get(type), &ops[i]))
~~~~~^~~
/Users/username/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3594:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
/Users/username/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3597:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
^
2 errors generated.
make: *** [Release/obj.target/grpc_node/ext/call.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:321:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/Cellar/node/13.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/username/Development/angular/idea-portal/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/username/Development/angular/idea-portal/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v79"
gyp ERR! cwd /Users/username/Development/angular/idea-portal/node_modules/grpc
gyp ERR! node -v v13.6.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/13.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/username/Development/angular/idea-portal/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/username/Development/angular/idea-portal/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/username/Development/angular/idea-portal/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:321:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1028:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Darwin 19.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/13.6.0/bin/node" "/Users/username/Development/angular/idea-portal/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/username/Development/angular/idea-portal/node_modules/grpc
node-pre-gyp ERR! node -v v13.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/13.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/username/Development/angular/idea-portal/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/username/Development/angular/idea-portal/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
npm WARN @angular/animations@8.2.14 requires a peer of @angular/core@8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN karma-jasmine-html-reporter@1.5.1 requires a peer of jasmine-core@>=3.5 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.23.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.23.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2020-01-16T20_34_52_595Z-debug.log
Angular CLI: 8.3.22
Node: 13.6.0
OS: darwin x64
Angular: 8.0.3
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.6
@angular-devkit/build-angular 0.800.6
@angular-devkit/build-optimizer 0.800.6
@angular-devkit/build-webpack 0.800.6
@angular-devkit/core 8.0.6
@angular-devkit/schematics 8.3.22
@angular/animations 8.2.14
@angular/cdk 8.2.3
@angular/cli 8.3.22
@angular/fire 5.3.0
@angular/material 8.2.3
@ngtools/webpack 8.0.6
@schematics/angular 8.3.22
@schematics/update 0.803.22
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
我正在运行macOs Catalina的最新版本
使用'ng new'创建新项目时,我也收到关于core-js @ 3的奇怪警告,但是生成的新Angular项目确实可以编译并运行:
username@mbp-> ng new test
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE test/README.md (1022 bytes)
CREATE test/.editorconfig (246 bytes)
CREATE test/.gitignore (631 bytes)
CREATE test/angular.json (3577 bytes)
CREATE test/package.json (1290 bytes)
CREATE test/tsconfig.json (543 bytes)
CREATE test/tslint.json (1953 bytes)
CREATE test/browserslist (429 bytes)
CREATE test/karma.conf.js (1016 bytes)
CREATE test/tsconfig.app.json (270 bytes)
CREATE test/tsconfig.spec.json (270 bytes)
CREATE test/src/favicon.ico (948 bytes)
CREATE test/src/index.html (290 bytes)
CREATE test/src/main.ts (372 bytes)
CREATE test/src/polyfills.ts (2838 bytes)
CREATE test/src/styles.css (80 bytes)
CREATE test/src/test.ts (642 bytes)
CREATE test/src/assets/.gitkeep (0 bytes)
CREATE test/src/environments/environment.prod.ts (51 bytes)
CREATE test/src/environments/environment.ts (662 bytes)
CREATE test/src/app/app-routing.module.ts (246 bytes)
CREATE test/src/app/app.module.ts (393 bytes)
CREATE test/src/app/app.component.css (0 bytes)
CREATE test/src/app/app.component.html (25530 bytes)
CREATE test/src/app/app.component.spec.ts (1092 bytes)
CREATE test/src/app/app.component.ts (208 bytes)
CREATE test/e2e/protractor.conf.js (808 bytes)
CREATE test/e2e/tsconfig.json (214 bytes)
CREATE test/e2e/src/app.e2e-spec.ts (637 bytes)
CREATE test/e2e/src/app.po.ts (262 bytes)
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
> fsevents@1.2.11 install /Users/username/Development/angular/test/node_modules/@angular/compiler-cli/node_modules/fsevents
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> fsevents@1.2.11 install /Users/jusername/Development/angular/test/node_modules/karma/node_modules/fsevents
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> fsevents@1.2.11 install /Users/username/Development/angular/test/node_modules/watchpack/node_modules/fsevents
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> fsevents@1.2.11 install /Users/username/Development/angular/test/node_modules/webpack-dev-server/node_modules/fsevents
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
> core-js@3.2.1 postinstall /Users/username/Development/angular/test/node_modules/core-js
> node scripts/postinstall || echo "ignore"
> core-js@2.6.11 postinstall /Users/username/Development/angular/test/node_modules/karma/node_modules/core-js
> node -e "tryrequire('./postinstall')catch(e)"
> @angular/cli@8.3.23 postinstall /Users/username/Development/angular/test/node_modules/@angular/cli
> node ./bin/postinstall/script.js
npm WARN karma-jasmine-html-reporter@1.5.1 requires a peer of jasmine-core@>=3.5 but none is installed. You must install peer dependencies yourself.
added 1443 packages from 1068 contributors and audited 19051 packages in 34.442s
23 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Successfully initialized git.
我不确定是什么导致了所有这些。看来node和angular cli的安装成功。
答案
- 尝试删除“ node_modules”文件夹,然后再次“ npm install”。
- 检查'.npmrc'配置
另一答案
我曾经遇到一个名叫Catalina的女孩,她非常生气。可能是相关问题?。
以上是关于[为什么在macOS Catalina上为Angular项目运行npm install时出现这些故障?的主要内容,如果未能解决你的问题,请参考以下文章
如何在 macOS Catalina 上使用 Instruments 附加进程?
macOS Catalina 更新后 Python 模块无法正常工作
在 MacOS 上为 Flutter 安装 cocoapods 时出现问题
无法在 macOS 上为 Python 3.6 导入 pdftotext