当我尝试在超级账本中运行enrollAdmin.js时,我始终会遇到此错误
Error: Cannot find module 'Downloads\Hyperledger\fabric-samples-release-1.2\fabcar\node_modules\fabric-client\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (Downloads\Hyperledger\fabric-samples-release-1.2\fabcar\node_modules\fabric-client\node_modules\grpc\src\grpc_extension.js:32:13)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
我可以在文件目录中找到该文件,但是由于某些原因,在运行代码时找不到该模块。
我已经多次运行npm install,以及npm install grpc,但这似乎并不能解决问题。请告知
我在文件上运行了第一个npm安装,这是味精
Downloads\Hyperledger\fabric-samples-release-1.2\fabcar\node_modules\grpc\src\node\extension_binary>npm install
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated hoek@2.16.3: The major version is no longer supported. Please update to 4.x or newer
> grpc@1.15.1 install Downloads\Hyperledger\fabric-samples-release-1.2\fabcar\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
[grpc] Success: "Downloads\Hyperledger\fabric-samples-release-1.2\fabcar\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN The package lodash is included as both a dev and production dependency.
added 225 packages from 555 contributors and audited 655 packages in 62.783s
found 16 vulnerabilities (1 low, 14 moderate, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
此后我还进行了重建
文件grpc_node.node已创建,但是没有找到相同模块的错误提示。
更新 我意识到扩展参考是不同的
Downloads\Hyperledger\fabric-samples-release-1.2\fabcar\node_modules\fabric-client\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown
因此重新运行npm安装并遇到此错误
node-pre-gyp install --fallback-to-build --library = static_library
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-win32-x64-unknown.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.10.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Pre-built binaries not installable for grpc@1.10.1 and node@10.10.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Hit error Connection closed while downloading tarball file
答案 0 :(得分:1)
您可以尝试以下步骤:
<FABCAR_DIR>/node_modules/grpc/src/node/extension_binary/
npm install
npm rebuild
第2步或第3步-其中一个应解决问题-按相同顺序尝试。
您可以查看是否成功安装了node_modules:
[grpc]成功:“ / home / ms / fabric-samples-release-1.2 / fabcar / node_modules / grpc / src / node / extension_binary / node-v59-linux-x64-glibc / grpc_node.node “是通过远程安装的
在第2步或第3步之后-您应该看到一个文件。
<FABCAR_DIR>/node_modules/grpc/src/node/extension_binary/node-v46-linux-x64-glibc/grpc_node.node
之后,注册管理员应该会像这样成功
sprint @ fabcar>节点enrollAdmin.js存储路径:/home/ms/fabric-samples-release-1.2/fabcar/hfc-key-store成功注册了管理员用户“ admin”,将管理员用户分配给了织物客户端:: {“ name”:“ admin”,“ mspid”:“ Org1MSP”,“ roles”:null,“ affiliation”:“”,“ enrollmentSecret”:“”,“ enrollment”:{“ signingIdentity”: “ 42d8536072cf7e47358c137b254d78d8e853934caee70d03dbec06a22f482ad9”,“身份”:{“ certificate”:“ ----- BEGIN CERTIFICATE -----}
如果您仔细观察,将显示startFabric.sh的输出
“首先安装必需的软件包,然后运行npm install
,然后运行node enrollAdmin.js
,然后运行node registerUser.js
”
答案 1 :(得分:0)
好像没有针对Node 10的预构建二进制文件。您可以切换到Node8或其他版本的Node 10,然后重试吗?
ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.10.0