【问题标题】:Error installing Realm via npm: npm ERR! Failed at the realm@1.2.0 install script 'node-pre-gyp install --fallback-to-build'通过 npm 安装 Realm 时出错:npm ERR!在领域@1.2.0 安装脚本“node-pre-gyp install --fallback-to-build”失败
【发布时间】:2017-05-10 11:04:57
【问题描述】:

我发现了关于其他节点包的二进制构建回退的其他问题,但对于 Realm 则没有。我尝试了其他场景的一些解决方案,例如:

删除/home/.node-gyp

安装build-essential/安装libkrb5-dev

从项目根目录和node-gyp 中删除node_modules,然后重新创建npm install

然而,当我运行 npm install --save realm 时,我得到了这个错误跟踪:

node-pre-gyp ERR! Tried to download(404): https://static.realm.io/node-pre-gyp/realm-v1.2.0-node-v51-linux-ia32.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for realm@1.2.0 and node@7.5.0 (node-v51 ABI) (falling back to source compile with node-gyp) 
make: Entering directory `/home/..../node_modules/realm/build'
  ACTION binding_gyp_vendored_realm_target_download_realm /home/..../node_modules/realm/vendor/realm-node
Downloading dependency: realm-node 2.4.0
Using cached realm-node from TMPDIR
Skipping the sync download because ENABLE_SYNC is false.
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
g++: error: unrecognized command line option ‘-std=c++14’
make: *** [Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o] Error 1
make: Leaving directory `/home/..../node_modules/realm/build'
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:285:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:192:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-75-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/./node_modules/realm/compiled/node-v51_linux_ia32/realm.node" "--module_name=realm" "--module_path=/home/..../node_modules/realm/compiled/node-v51_linux_ia32"
gyp ERR! cwd /home/..../node_modules/realm
gyp ERR! node -v v7.5.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/..../node_modules/realm/compiled/node-v51_linux_ia32/realm.node --module_name=realm --module_path=/home/..../node_modules/realm/compiled/node-v51_linux_ia32' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/..../node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:192:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:890:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.0-75-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/..../node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/..../node_modules/realm
node-pre-gyp ERR! node -v v7.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.34
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/..../node_modules/realm/compiled/node-v51_linux_ia32/realm.node --module_name=realm --module_path=/home/..../node_modules/realm/compiled/node-v51_linux_ia32' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! realm@1.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the realm@1.2.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

我正在使用节点版本 7.5.0 和 npm 版本 4.5.0。 我有node-pre-gyp 包。 怎么回事?!

【问题讨论】:

    标签: node.js ubuntu npm realm


    【解决方案1】:

    下面一步一步试试,

    在项目文件夹中安装旧版本

    npm install --save realm@0.14.3
    

    打开 node_modules/realm/package.json 并删除这一行:

    "postlink": "node_modules/realm/scripts/rnpm-postlink.js"
    

    链接

    react-native link realm
    

    找到解决办法here

    【讨论】:

    • 成功了!谢谢!!我以为我到处找。现在这是这个问题的官方 StackOverflow 答案,因为链接的解决方案是伪装的!
    猜你喜欢
    • 2020-04-13
    • 2016-02-12
    • 1970-01-01
    • 2018-08-05
    • 2020-08-03
    • 1970-01-01
    • 1970-01-01
    • 2019-12-22
    • 2016-02-01
    相关资源
    最近更新 更多