为什么在macOS Catalina上为Angular项目运行npm install时出现这些错误?

时间:2020-01-16 21:49:03

标签: node.js angular npm-install

我有一个仅在几个月前就已开始工作的角度项目,并已检查到git repo。我有一台运行Catalina的新Macbook,并在全球范围内安装了node和angular cli。从git repo克隆项目后,我运行了'npm install',安装失败。有人可以帮我解决这个问题吗?似乎深入到了角度和节点,对此我有点陌生。这是输出:

function foo() {
  msg = new SpeechSynthesisUtterance(),
    voices = window.speechSynthesis.getVoices();

  console.log("How many voices", voices.length);

  msg.text = "Hello World";
  speechSynthesis.speak(msg);
}

foo();
setTimeout(foo, 0);   // just try again in the next event cycle

我正在运行最新版本的macOs Catalina

使用'ng new'创建新项目时,我也收到关于core-js @ 3的奇怪警告,但生成的新Angular项目确实可以编译并运行:

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

我不确定是什么导致了所有这些。看来node和angular cli的安装成功了。

1 个答案:

答案 0 :(得分:0)

此问题已解决。 node-gyp当前不支持最新的nodejs(v13),因此回滚到v12已对其进行了修复。