【问题标题】:nodejs npm failed to instal hdf5nodejs npm 安装 hdf5 失败
【发布时间】:2020-08-07 13:06:19
【问题描述】:

我正在 Mac 上开发一个 react native 项目,我正在尝试通过运行此命令来安装 hdf5

节点版本:12.8.3

所以:Mac Os Catalina

npm install hdf5

但我得到一个编译错误,我在网上查找了问题,但我无法解决它

这是我得到的:

clangclang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
In file included from ../src/h5ds.cc:2:
../src/file.h:11:10: fatal error: 'hdf5.h' file not found
#include "hdf5.h"
         ^~~~~~~~
In file included from ../src/h5im.cc:2:
../src/file.h:11:10: fatal error: 'hdf5.h' file not found
#include "hdf5.h"
         ^~~~~~~~
1 error generated.
1 error generated.
In file included from ../src/uint64.cc:1:
../src/uint64.hpp:24:32: error: no template named 'Handle' in namespace 'v8'
    static void Initialize(v8::Handle<v8::Object> target);
                           ~~~~^
                                                                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/Users/ahmed/Library/Caches/node-gyp/12.18.3/include/node/v8.h:2668:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
                              
../src/int64.hpp:58:149: error: no matching member function for call to 'ToString'
        std::string value = args[args.Length() - 1]->IsUndefined() ? std::string("0") : std::string(*v8::String::Utf8Value(args[args.Length() - 1]->ToString()));
                                                                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
make: *** [Release/obj.target/h5im/src/h5im.o] Error 1
make: *** Waiting for unfinished jobs....
/Users/ahmed/Library/Caches/node-gyp/12.18.3/include/node/v8.h:2668:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
make: *** [Release/obj.target/h5ds/src/h5ds.o] Error 1
In file included from ../src/uint64.cc:1:
../src/uint64.hpp:64:81: error: too few arguments to function call, single argument 'context' was not specified
        xp = new Uint64((unsigned long long)args[args.Length() - 1]->Int32Value());
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/ahmed/Library/Caches/node-gyp/12.18.3/include/node/v8.h:2709:3: note: 'Int32Value' declared here
  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  ^
.....

3 warnings and 8 errors generated.
3 warnings and 8 errors generated.
make: *** [Release/obj.target/h5lt/src/uint64.o] Error 1
make: *** [Release/obj.target/h5lt/src/int64.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--jobs" "max"
gyp ERR! cwd /Users/ahmed/Desktop/ReactSleepLogger/node_modules/hdf5
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN @react-native-community/cli@4.10.1 requires a peer of react-native@^0.62.0-rc.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hdf5@0.3.5 install: `node-gyp rebuild --jobs max`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hdf5@0.3.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我能做些什么来解决这个问题?有没有其他方法可以将 hdf5 与 react 一起使用?

【问题讨论】:

  • 你的节点版本和你的 SO 是什么?
  • @DeivisonSporteman 节点版本:v12.18.3; mac os catalina 版本:10.15.5

标签: node.js react-native npm node-gyp


【解决方案1】:

您需要使用自制软件安装 hdf5。

试试:

brew install hdf5

brew install homebrew/science/hdf5

您可以在此处查看如何安装 brew:https://brew.sh/

【讨论】:

  • 感谢您的回答,但即使在使用自制软件安装 hdf5 后,我仍然遇到与“npm”相同的错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-04
  • 2012-12-07
  • 1970-01-01
相关资源
最近更新 更多