【问题标题】:NPM install sqlite3 error: node-gyp rebuild "No such file or directory"NPM 安装 sqlite3 错误:node-gyp 重建“没有这样的文件或目录”
【发布时间】:2013-07-01 20:08:31
【问题描述】:

我似乎无法在 OSX Snow Leopard 中通过 npm 安装 sqlite3,我无法确定原因:

bravo-de-esmolfo:project knight4$ npm install sqlite3
npm WARN package.json application-name@0.0.1 No repository field.
npm WARN package.json application-name@0.0.1 No readme data.
npm http GET https://registry.npmjs.org/sqlite3
npm http 304 https://registry.npmjs.org/sqlite3
npm http GET https://registry.npmjs.org/tar.gz
npm http 304 https://registry.npmjs.org/tar.gz
npm WARN engine tar.gz@0.1.1: wanted: {"node":"0.8.x"} (current: {"node":"v0.10.10","npm":"1.2.25"})
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/tar
npm http 304 https://registry.npmjs.org/fstream
npm http 200 https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/block-stream
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/block-stream

> sqlite3@2.1.10 install /Users/knight4/Desktop/project/node_modules/sqlite3
> node-gyp rebuild

Traceback (most recent call last):
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp", line 18, in <module>
    sys.exit(gyp.main(sys.argv[1:]))
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 523, in main
    return gyp_main(args)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 508, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2105, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 769, in Write
    self.Pchify))
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1154, in WriteSources
    cflags = self.xcode_settings.GetCflags(configname)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 260, in GetCflags
    sdk_root = self._SdkPath()
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 247, in _SdkPath
    return os.path.join(self._GetSdkBaseDir(),
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 230, in _GetSdkBaseDir
    stderr=subprocess.STDOUT)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
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:415:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 10.8.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/knight4/Desktop/project/node_modules/sqlite3
gyp ERR! node -v v0.10.10
gyp ERR! node-gyp -v v0.9.6
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

有什么想法吗?干杯

【问题讨论】:

  • 你的 npm、node-gyp、gcc/g++、python 和 make 版本是什么?我的猜测是某个地方存在版本问题,例如 node-gyp 不支持 python 3.x.x
  • node-gyp@0.10.4 node@0.10.10
  • 在python上好像卡住了,路径里是python吗,是什么版本?
  • 此外,TooTallNate 似乎也在 2 小时前发布了一个更改,这可能有助于从版本号中剥离 rc:github.com/TooTallNate/node-gyp/commit/… .... 尝试执行此操作:“ python -c '导入平台;打印(platform.python_version());' "
  • Python 2.7.5。我正在下载 Xcode,因为我必须在一个月前更换硬盘驱动器 - 所以,gcc 和 make 目前没有安装。在任何情况下,它们都安装在我的另一个(油炸)驱动器中,然后它不起作用,但不遗余力。

标签: node.js sqlite npm


【解决方案1】:

在 OSX 上,node-gyp 依赖于 python 2.7、make 和 gcc/g++。 make、gcc和g++可以通过安装XCode,然后使用XCode安装命令行工具来安装。

【讨论】:

    猜你喜欢
    • 2022-06-10
    • 2023-03-17
    • 2019-10-07
    • 1970-01-01
    • 2018-02-15
    • 2015-12-07
    • 1970-01-01
    • 1970-01-01
    • 2015-12-23
    相关资源
    最近更新 更多