在MacOS上使用npm安装时出现了“node-pre-gyp install --fallback-to-build error”的错误。

3
在OSX上运行,节点版本为0.12.0,正在运行。
npm install --production

给 Ghost 安装 sqlite3 v. 3.0.4 时,我遇到了以下错误:
> node-pre-gyp install --fallback-to-build

child_process: customFds option is deprecated, use stdio instead. gyp: /Users/USER/.node/common.gypi not found (cwd:
/Users/USER/Documents/personal_website/ghost/node_modules/sqlite3) while reading includes of binding.gyp while trying to load binding.gyp gyp 
ERR! configure error  gyp 
ERR! stack Error: `gyp` failed with exit code: 1 gyp 
ERR! stack     at ChildProcess.onCpExit
(/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16) gyp ERR! stack     at ChildProcess.emit (events.js:110:17) gyp ERR! stack     at
Process.ChildProcess._handle.onexit (child_process.js:1067:12) gyp     

ERR! System Darwin 14.1.0 gyp ERR! command "node"
"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=sqlite3" "--configuration=Release" "--module_name=node_sqlite3" "--version=3.0.4" "--major=3" "--patch=4" "--runtime=node" "--node_abi=node-v14" "--platform=darwin" "--target_platform=darwin" "--arch=x64" "--target_arch=x64" "--module_main=./lib/sqlite3" "--host=https://mapbox-node-binary.s3.amazonaws.com/" "--module_path=/Users/USER/Documents/personal_website/ghost/node_modules/sqlite3/lib/binding/node-v14-darwin-x64" "--module=/Users/USER/Documents/personal_website/ghost/node_modules/sqlite3/lib/binding/node-v14-darwin-x64/node_sqlite3.node" "--remote_path=./sqlite3/v3.0.4/" "--package_name=node-v14-darwin-x64.tar.gz" "--staged_tarball=build/stage/sqlite3/v3.0.4/node-v14-darwin-x64.tar.gz" "--hosted_path=https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.0.4/" "--hosted_tarball=https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.0.4/node-v14-darwin-x64.tar.gz" "--nodedir=/Users/USER/.node" gyp 
ERR! cwd /Users/USER/Documents/personal_website/ghost/node_modules/sqlite3 gyp 

ERR! node -v v0.12.0 gyp ERR! node-gyp -v v1.0.2 gyp ERR! not ok

npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "--production"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! sqlite3@3.0.4 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sqlite3@3.0.4 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the sqlite3 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 their info via:
npm ERR!     npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

我已经将 /usr/local/share/npm/bin 添加到了PATH环境变量中。

你解决了吗? - user1692333
5个回答

1
当我尝试安装Ghost时,我也遇到了这个错误。看起来node-sqlite3出了问题,因为我已经看到其他人发布了此错误。一旦node-sqlite3被修复,可能会有更多的问题:
Ghost目前不支持node 0.12.x。从README.md中可以看到:
Ghost需要Node v0.10.x https://github.com/TryGhost/Ghost/issues/4240有更多信息。
我可能会安装一个旧版本的node,直到ghost有一个新版本。

1

npm i sqlite3 --build-from-source 可能有效


0

控制台显示如下:

node pre gyp install --fallback-to-build

这是安装在32位版本中的。 等待一段时间后,它会自动变成64位。 一切都很好。


0

如果您直接从Github存储库下载Ghost,许多由于package.json文件引起的问题已经得到解决。

例如,您可以看到以下显著变化,以解决一些安装问题:

"engines": { "node": "~0.10.0 || ~0.12.0", "iojs": "~1.2.0" }, 还有在dependencies中的:

"html-to-text": "1.2.0", "sqlite3": "3.0.5",


0

我也遇到了这个错误。将nodejs降级到0.10.9,使用npm版本2.5.1后,我可以顺利执行npm install --production而不出现错误。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接