无法在 webstorm 上安装 web3(在 mac 上)

Posted

技术标签:

【中文标题】无法在 webstorm 上安装 web3(在 mac 上)【英文标题】:Can't install web3 on webstorm(on mac) 【发布时间】:2020-03-15 01:15:12 【问题描述】:

我无法在 webstorm(Mac 上)上安装 web3(1.2.4)。

我尝试重新安装 webstorm,但没有成功。

我的环境是mac os(10.14.6) & webstorm(2019.2.4)。

错误消息如下。请告诉我如何解决这个问题。

谢谢。

/Users/Pierogi/Library/Preferences/WebStorm2019.2/node/node-v10.16.0-darwin-x64/bin/node /Users/Pierogi/Library/Preferences/WebStorm2019.2/node/node-v10.16.0-darwin-x64/lib/node_modules/npm/bin/npm-cli.js install web3@1.2.4

Standard error:
npm WARN deprecated @types/bignumber.js@5.0.0: This is a stub types definition for bignumber.js (https://github.com/MikeMcl/bignumber.js/). bignumber.js provides its own type definitions, so you don't need @types/bignumber.js installed!
npm WARN lifecycle The node binary used for scripts is /usr/local/bin/node but npm is using /Users/Pierogi/Library/Preferences/WebStorm2019.2/node/node-v10.16.0-darwin-x64/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
In file included from ../src/addon.cpp:9:
In file included from ../src/KeccakNISTInterface.h:17:
../src/KeccakSponge.h:23:9: warning: 'ALIGN' macro redefined [-Wmacro-redefined]
#define ALIGN __attribute__ ((aligned(32)))
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/i386/param.h:83:9: note: previous definition is here
#define ALIGN(p)        __DARWIN_ALIGN(p)
        ^
../src/addon.cpp:83:11: error: no matching member function for call to 'Set'
                target->Set(className, f);
                ~~~~~~~~^~~
/Users/Pierogi/Library/Caches/node-gyp/13.1.0/include/node/v8.h:3424:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/Pierogi/Library/Caches/node-gyp/13.1.0/include/node/v8.h:3427:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
1 warning and 1 error generated.
make: *** [Release/obj.target/sha3/src/addon.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/Pierogi/Library/Preferences/WebStorm2019.2/node/node-v10.16.0-darwin-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/Cellar/node/13.1.0/bin/node" "/Users/Pierogi/Library/Preferences/WebStorm2019.2/node/node-v10.16.0-darwin-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/Pierogi/Documents/WebStorm project/191112/node_modules/sha3
gyp ERR! node -v v13.1.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm WARN bookshelf@1.0.1 requires a peer of knex@>=0.15.0 <0.20.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sha3@1.2.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sha3@1.2.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/Pierogi/.npm/_logs/2019-11-19T13_11_28_555Z-debug.log


Standard output:

> sha3@1.2.3 install /Users/Pierogi/Documents/WebStorm project/191112/node_modules/sha3
> node-gyp rebuild

  CXX(target) Release/obj.target/sha3/src/addon.o


Process finished with exit code 1

【问题讨论】:

【参考方案1】:

尝试通过运行安装编译器和一些支持实用程序:

xcode-select --install

希望对你有帮助!

【讨论】:

您好,感谢您的回复。我试过你的建议。但它没有用。但是我尝试安装 web3@2.0.0alpha.1 并且它可以工作。我不知道原因。虽然这是 alpha 版本,但我继续使用这个。谢谢!

以上是关于无法在 webstorm 上安装 web3(在 mac 上)的主要内容,如果未能解决你的问题,请参考以下文章

无法在 Windows 10 上 npm 安装 web3

webstorm配置内存参数,解决卡顿

mac上安装了webstorm,建立工程后找不到html文件所在的文件夹

我无法安装 Web3

无法使用 nodejs 安装 web3

WebStorm 安装配置指南