Error: Cannot find module 'fabric-client'
Error: Cannot find module 'fabric-client'
正常后运行./startFabric.sh(显示如下):
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
然后我尝试 运行 npm install
在 \facbar
但是我又犯错了。
$ npm install
> grpc@1.2.4 install C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-
release\fabcar\node_modules\grpc
> node-pre-gyp install --fallback-to-build
node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ 'C:\Program Files\nodejs\node.exe',
node-pre-gyp verb cli 'C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-
samples-release\fabcar\node_modules\grpc\node_modules\node-pre-
gyp\bin\node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using node-pre-gyp@0.6.34
node-pre-gyp info using node@6.11.0 | win32 | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "C:\Users\Lenovo.WIN10-
20170627G\Desktop\fabric-samples-
release\fabcar\node_modules\grpc\src\node\extension_binary\grpc_node.node"
(not found)
node-pre-gyp http GET https://storage.googleapis.com/grpc-precompiled-
binaries/node/grpc/v1.2.4/node-v48-win32-x64.tar.gz
node-pre-gyp http 200 https://storage.googleapis.com/grpc-precompiled-
binaries/node/grpc/v1.2.4/node-v48-win32-x64.tar.gz
node-pre-gyp info install unpacking grpc_node.node
node-pre-gyp info tarball done parsing tarball
node-pre-gyp info validate Running test command: 'C:\Program
Files\nodejs\node.exe --eval 'require(\'C:/Users/Lenovo.WIN10-
20170627G/Desktop/fabric-samplesrelease/fabcar/node_modules/grpc/src/node/extension_binary/grpc_node.node\')''
[grpc] Success: "C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-release\fabcar\node_modules\grpc\src\node\extension_binary\grpc_node.node" is
installed via remote
node-pre-gyp info ok
> x509@0.3.2 install C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-release\fabcar\node_modules\x509
> node-gyp rebuild
C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-release\fabcar\node_modules\x509>if not defined npm_config_node_gyp (node
"C:\Users\Lenovo.WIN10-
20170627G\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-
bin\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node ""
rebuild )
▒ڴ˽▒▒▒▒▒▒▒▒һ▒▒▒▒▒▒һ▒▒▒▒Ŀ▒▒▒▒Ҫ▒▒▒ò▒▒▒▒▒▒ɣ▒▒▒▒▒ӡ▒/m▒▒▒▒▒ء▒
MSBUILD : error MSB4132: ▒▒ʶ▒߰汾▒▒2.0▒▒▒▒▒▒▒õĹ▒▒߰汾Ϊ "4.0"▒▒
gyp ERR! build error
gyp ERR! stack Error:
`C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit
code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\Lenovo.WIN10-
20170627G\AppData\Roaming\npm\node_modules\npm\node_modules\node-
gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe"
"C:\Users\Lenovo.WIN10-
20170627G\AppData\Roaming\npm\node_modules\npm\node_modules\node-
gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-
release\fabcar\node_modules\x509
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN fabcar@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! x509@0.3.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the x509@0.3.2 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! C:\Users\Lenovo.WIN10-20170627G\AppData\Roaming\npm-
cache\_logs17-07-21T07_51_26_723Z-debug.log
然后我尝试执行 node query.js
我发现节点模块 fabric-client
没有安装。
module.js:471
throw err;
^
Error: Cannot find module 'fabric-client'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-release\fabcar\query.js:11:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
我尝试 node install fabric-client
并得到与 npm install
相同的错误,从
开始
> x509@0.3.2 install C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-
release\fabcar\node_modules\x509
> node-gyp rebuild.
到最后。
环境相同:
请帮助,谢谢。
看起来您没有 npm 在 Windows 上工作所需的所有部分。
尝试执行 "npm install --global windows-build-tools",完成后,重新运行 "npm install"。
有关详细信息,请参阅 https://www.npmjs.com/package/windows-build-tools
阿尔诺
就我而言,我做到了
$ npm update
这应该包括 fabric-client@1.1.2(在 DateTime.Now = Jun/09/2018)
运行需要Fabric客户端和Fabric CA客户端包,你必须通过"npm install"安装到文件夹中,如果此操作不成功,请删除node_modules文件夹然后重新安装,您可以使用 "rm -rf node_modules" 删除它。
我在 mac 上遇到了同样的问题,我不得不重新安装 xcode 工具
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
rm package-lock.json
rm -rf node_modules
npm install
这应该可以解决问题并安装所有软件包。
正常后运行./startFabric.sh(显示如下):
2017-07-21 07:47:37.477 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO
00a Chaincode invoke successful. result: status:200
2017-07-21 07:47:37.477 UTC [main] main -> INFO 00b Exiting.....
Total execution time : 364 secs ...
然后我尝试 运行 npm install
在 \facbar
但是我又犯错了。
$ npm install
> grpc@1.2.4 install C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-
release\fabcar\node_modules\grpc
> node-pre-gyp install --fallback-to-build
node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ 'C:\Program Files\nodejs\node.exe',
node-pre-gyp verb cli 'C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-
samples-release\fabcar\node_modules\grpc\node_modules\node-pre-
gyp\bin\node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using node-pre-gyp@0.6.34
node-pre-gyp info using node@6.11.0 | win32 | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "C:\Users\Lenovo.WIN10-
20170627G\Desktop\fabric-samples-
release\fabcar\node_modules\grpc\src\node\extension_binary\grpc_node.node"
(not found)
node-pre-gyp http GET https://storage.googleapis.com/grpc-precompiled-
binaries/node/grpc/v1.2.4/node-v48-win32-x64.tar.gz
node-pre-gyp http 200 https://storage.googleapis.com/grpc-precompiled-
binaries/node/grpc/v1.2.4/node-v48-win32-x64.tar.gz
node-pre-gyp info install unpacking grpc_node.node
node-pre-gyp info tarball done parsing tarball
node-pre-gyp info validate Running test command: 'C:\Program
Files\nodejs\node.exe --eval 'require(\'C:/Users/Lenovo.WIN10-
20170627G/Desktop/fabric-samplesrelease/fabcar/node_modules/grpc/src/node/extension_binary/grpc_node.node\')''
[grpc] Success: "C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-release\fabcar\node_modules\grpc\src\node\extension_binary\grpc_node.node" is
installed via remote
node-pre-gyp info ok
> x509@0.3.2 install C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-release\fabcar\node_modules\x509
> node-gyp rebuild
C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-release\fabcar\node_modules\x509>if not defined npm_config_node_gyp (node
"C:\Users\Lenovo.WIN10-
20170627G\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-
bin\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node ""
rebuild )
▒ڴ˽▒▒▒▒▒▒▒▒һ▒▒▒▒▒▒һ▒▒▒▒Ŀ▒▒▒▒Ҫ▒▒▒ò▒▒▒▒▒▒ɣ▒▒▒▒▒ӡ▒/m▒▒▒▒▒ء▒
MSBUILD : error MSB4132: ▒▒ʶ▒߰汾▒▒2.0▒▒▒▒▒▒▒õĹ▒▒߰汾Ϊ "4.0"▒▒
gyp ERR! build error
gyp ERR! stack Error:
`C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit
code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\Lenovo.WIN10-
20170627G\AppData\Roaming\npm\node_modules\npm\node_modules\node-
gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe"
"C:\Users\Lenovo.WIN10-
20170627G\AppData\Roaming\npm\node_modules\npm\node_modules\node-
gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-
release\fabcar\node_modules\x509
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN fabcar@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! x509@0.3.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the x509@0.3.2 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! C:\Users\Lenovo.WIN10-20170627G\AppData\Roaming\npm-
cache\_logs17-07-21T07_51_26_723Z-debug.log
然后我尝试执行 node query.js
我发现节点模块 fabric-client
没有安装。
module.js:471
throw err;
^
Error: Cannot find module 'fabric-client'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-release\fabcar\query.js:11:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
我尝试 node install fabric-client
并得到与 npm install
相同的错误,从
> x509@0.3.2 install C:\Users\Lenovo.WIN10-20170627G\Desktop\fabric-samples-
release\fabcar\node_modules\x509
> node-gyp rebuild.
到最后。
环境相同:
请帮助,谢谢。
看起来您没有 npm 在 Windows 上工作所需的所有部分。 尝试执行 "npm install --global windows-build-tools",完成后,重新运行 "npm install"。 有关详细信息,请参阅 https://www.npmjs.com/package/windows-build-tools
阿尔诺
就我而言,我做到了
$ npm update
这应该包括 fabric-client@1.1.2(在 DateTime.Now = Jun/09/2018)
运行需要Fabric客户端和Fabric CA客户端包,你必须通过"npm install"安装到文件夹中,如果此操作不成功,请删除node_modules文件夹然后重新安装,您可以使用 "rm -rf node_modules" 删除它。
我在 mac 上遇到了同样的问题,我不得不重新安装 xcode 工具
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
rm package-lock.json
rm -rf node_modules
npm install
这应该可以解决问题并安装所有软件包。