当我尝试“npm install --only=prod @hyperledger/caliper-cli@0.4.2”时,我失败了为什么?

问题描述

我正在尝试按照 https://hyperledger.github.io/caliper/v0.4.2/installing-caliper/#versioning-semantics 中的文档使用 7.19.1 版从 NPM 安装 Caliper

enter image description here

当我运行命令时

npm install --only=prod @hyperledger/caliper-cli@0.4.2

它变成了:

npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated @web3-js/scrypt-shim@0.1.0: This package is deprecated,for a pure JS implementation please use scrypt-js
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the Now deprecated request package,see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated request@2.88.2: request has been deprecated,see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated multicodec@0.5.7: stable api reached
npm WARN deprecated @web3-js/websocket@1.0.30: The branch for this fork was merged upstream,please update your package to websocket@1.0.31
npm WARN deprecated @hapi/joi@15.1.1: joi is leaving the @hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411)
npm WARN deprecated ethereumjs-common@1.5.2: New versions are published within new scoped package name format @ethereumjs/common. Please update.
npm WARN deprecated core-js@2.6.12: 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! code 1
npm ERR! path /Users/zhuxingyu/vscode/caliper-workspace/node_modules/keccak
npm ERR! command Failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/keccak/src/addon.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.4.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.5 found at "/usr/local/opt/python@3.9/bin/python3.9"
npm ERR! (node:18836) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/local/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',npm ERR! gyp info spawn args   'binding.gyp',npm ERR! gyp info spawn args   '-f',npm ERR! gyp info spawn args   'make',npm ERR! gyp info spawn args   '-I',npm ERR! gyp info spawn args   '/Users/zhuxingyu/vscode/caliper-workspace/node_modules/keccak/build/config.gypi',npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',npm ERR! gyp info spawn args   '/Users/zhuxingyu/Library/Caches/node-gyp/16.4.0/include/node/common.gypi',npm ERR! gyp info spawn args   '-Dlibrary=shared_library',npm ERR! gyp info spawn args   '-Dvisibility=default',npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/zhuxingyu/Library/Caches/node-gyp/16.4.0',npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/zhuxingyu/Library/Caches/node-gyp/16.4.0/<(target_arch)/node.lib',npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/zhuxingyu/vscode/caliper-workspace/node_modules/keccak',npm ERR! gyp info spawn args   '-Dnode_engine=v8',npm ERR! gyp info spawn args   '--depth=.',npm ERR! gyp info spawn args   '--no-parallel',npm ERR! gyp info spawn args   '--generator-output',npm ERR! gyp info spawn args   'build',npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
npm ERR! 
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
npm ERR! 
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
npm ERR! 
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release','-C','build' ]
npm ERR! ../src/addon.cc:37:47: error: too few arguments to function call,single argument 'context' was not specified
npm ERR!     unsigned int rate = info[0]->IntegerValue();
npm ERR!                         ~~~~~~~~~~~~~~~~~~~~~ ^
npm ERR! /Users/zhuxingyu/Library/Caches/node-gyp/16.4.0/include/node/v8.h:3086:40: note: 'IntegerValue' declared here
npm ERR!   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
npm ERR!                                        ^
npm ERR! ../src/addon.cc:38:51: error: too few arguments to function call,single argument 'context' was not specified
npm ERR!     unsigned int capacity = info[1]->IntegerValue();
npm ERR!                             ~~~~~~~~~~~~~~~~~~~~~ ^
npm ERR! /Users/zhuxingyu/Library/Caches/node-gyp/16.4.0/include/node/v8.h:3086:40: note: 'IntegerValue' declared here
npm ERR!   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
npm ERR!                                        ^
npm ERR! ../src/addon.cc:56:48: error: too few arguments to function call,single argument 'context' was not specified
npm ERR!     unsigned char bits = info[0]->IntegerValue();
npm ERR!                          ~~~~~~~~~~~~~~~~~~~~~ ^
npm ERR! /Users/zhuxingyu/Library/Caches/node-gyp/16.4.0/include/node/v8.h:3086:40: note: 'IntegerValue' declared here
npm ERR!   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
npm ERR!                                        ^
npm ERR! ../src/addon.cc:64:43: error: too few arguments to function call,single argument 'context' was not specified
npm ERR!     size_t length = info[0]->IntegerValue();
npm ERR!                     ~~~~~~~~~~~~~~~~~~~~~ ^
npm ERR! /Users/zhuxingyu/Library/Caches/node-gyp/16.4.0/include/node/v8.h:3086:40: note: 'IntegerValue' declared here
npm ERR!   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
npm ERR!                                        ^
npm ERR! ../src/addon.cc:75:82: error: too few arguments to function call,single argument 'context' was not specified
npm ERR!     KeccakWrapper* to = Nan::ObjectWrap::Unwrap<KeccakWrapper>(info[0]->ToObject());
npm ERR!                                                                ~~~~~~~~~~~~~~~~~ ^
npm ERR! /Users/zhuxingyu/Library/Caches/node-gyp/16.4.0/include/node/v8.h:3045:44: note: 'ToObject' declared here
npm ERR!   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
npm ERR!                                            ^
npm ERR! 5 errors generated.
npm ERR! make: *** [Release/obj.target/keccak/src/addon.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` Failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.5.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/16.4.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/zhuxingyu/vscode/caliper-workspace/node_modules/keccak
npm ERR! gyp ERR! node -v v16.4.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/zhuxingyu/.npm/_logs/2021-07-02T08_03_17_038Z-debug.log

我已经试过了:

  • npm 更新
  • npm install -g npm

而且我认为我的 npm 已经是最新的了。

有没有人解决过这样的问题?我不熟悉 npm 工具。提前致谢。

解决方法

已解决:我正在使用清华大学的镜像,其中一部分已过时。所以我把我的镜子改回官方的,它修复了。

npm config set registry http://www.npmjs.org

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...