[英]Error installing generator hyperledger composer on MAC OS
我正在嘗試在我的 Mac 上安裝 Hyperledger Composer 開發環境。 但是當我嘗試使用以下命令安裝 CLI 工具時:
npm install -g composer-cli
出現以下錯誤消息。 我試圖將節點版本回滾到 6/7,但沒有成功。
npm WARN 已棄用 fs-promise@1.0.0:使用 mz 或 fs-extra^3.0 與 Promise 支持
npm WARN deprecated crypto@0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
> pkcs11js@1.0.12 install /usr/local/lib/node_modules/generator-hyperledger-composer/node_modules/pkcs11js
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Python executable "/Users/jloo/anaconda/bin/python" is v3.5.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack at PythonFinder.failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:492:19)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:474:14)
gyp ERR! stack at ChildProcess.exithandler (child_process.js:264:7)
gyp ERR! stack at ChildProcess.emit (events.js:159:13)
gyp ERR! stack at maybeClose (internal/child_process.js:943:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:363:11)
gyp ERR! stack at Socket.emit (events.js:159:13)
gyp ERR! stack at Pipe._handle.close [as _onclose] (net.js:558:12)
gyp ERR! System Darwin 17.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/generator-hyperledger-composer/node_modules/pkcs11js
gyp ERR! node -v v9.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1`enter code here`
npm ERR! pkcs11js@1.0.12 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js@1.0.12 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above
使用nvm並安裝 Node 版本 8 - 穩定版。 並嘗試使用該節點版本運行。
不支持節點 9,python 3 不適用於 npm 和 node-gyp。 它需要是python 2。請參閱https://hyperledger.github.io/composer/stable/installing/installing-prereqs#macos以幫助您獲得適當的pre-reqs
對我來說,如果我卸載所有內容並安裝NodeJs版本 8,它會起作用,如下所示:
# node -v
v8.17.0
# npm -v
6.13.4
然后在安裝之后(在 apt 獲取node- --unsafe-perm
之后) --unsafe-perm
像:
npm install -g --loglevel error --unsafe-perm composer-cli
希望有幫助...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.