React Native和Realm.js - node-pre-gyp 404错误

时间:2016-11-25 14:37:13

标签: react-native realm

我尝试安装Realm for React Native。不幸的是,安装失败但我不知道为什么。

我的设置:

  • Windows 10,
  • Node.js v4.6.2,
  • npm v3.10.9,
  • node-pre-gyp 0.6.31

命令行出错:

D:\Lab\react-native\Hello>npm install realm --save

> realm@0.15.0 install D:\Lab\react-native\Hello\node_modules\realm
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://static.realm.io/node-pre-gyp/realm-v0.15.0-node-v46-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for realm@0.15.0 and node@4.6.2 (node-v46 ABI) (falling back to source compile with node-gyp)

D:\Lab\react-native\Hello\node_modules\realm>if not defined npm_config_node_gyp (node "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean )  else (node "" clean )

D:\Lab\react-native\Hello\node_modules\realm>if not defined npm_config_node_gyp (node "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=D:\Lab\react-native\Hello\node_modules\realm\compiled\node-v46_win32_x64\realm.node --module_name=realm --module_path=D:\Lab\react-native\Hello\node_modules\realm\compiled\node-v46_win32_x64 )  else (node "" configure --fallback-to-build --module=D:\Lab\react-native\Hello\node_modules\realm\compiled\node-v46_win32_x64\realm.node --module_name=realm --module_path=D:\Lab\react-native\Hello\node_modules\realm\compiled\node-v46_win32_x64 )
Traceback (most recent call last):
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1988, in GenerateOutput
    generator_flags))
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 927, in _GenerateProject
    return _GenerateMSVSProject(project, options, version, generator_flags)
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1028, in _GenerateMSVSProject
    _AddAccumulatedActionsToMSVS(p, spec, actions_to_add)
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 468, in _AddAccumulatedActionsToMSVS
    cmd=command)
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 438, in _AddCustomBuildToolForMSVS
    _ConfigFullName(config_name, c_data), tools=[tool])
  File "C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSProject.py", line 181, in AddFileConfig
    raise ValueError('AddFileConfig: file "%s" not in project.' % path)
ValueError: AddFileConfig: file "..\..\binding.gyp" not in project.
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\USERNAME\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\USERNAME\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=D:\\Lab\\react-native\\Hello\\node_modules\\realm\\compiled\\node-v46_win32_x64\\realm.node" "--module_name=realm" "--module_path=D:\\Lab\\react-native\\Hello\\node_modules\\realm\\compiled\\node-v46_win32_x64"
gyp ERR! cwd D:\Lab\react-native\Hello\node_modules\realm
gyp ERR! node -v v4.6.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=D:\Lab\react-native\Hello\node_modules\realm\compiled\node-v46_win32_x64\realm.node --module_name=realm --module_path=D:\Lab\react-native\Hello\node_modules\realm\compiled\node-v46_win32_x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\Lab\react-native\Hello\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:854:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
node-pre-gyp ERR! System Windows_NT 10.0.14393
node-pre-gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\Lab\\react-native\\Hello\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\Lab\react-native\Hello\node_modules\realm
node-pre-gyp ERR! node -v v4.6.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=D:\Lab\react-native\Hello\node_modules\realm\compiled\node-v46_win32_x64\realm.node --module_name=realm --module_path=D:\Lab\react-native\Hello\node_modules\realm\compiled\node-v46_win32_x64' (1)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\USERNAME\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "realm" "--save"
npm ERR! node v4.6.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE

npm ERR! realm@0.15.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the realm@0.15.0 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the realm package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs realm
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls realm
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Lab\react-native\Hello\npm-debug.log

我尝试安装node-pre-gyp和node-gyp。我还检查了Python版本 - 一切都应该没问题,但出了点问题。

1 个答案:

答案 0 :(得分:1)

这是Windows上的一个已知问题,正在跟踪here。它应该很快修复。