0

我似乎无法在 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

有任何想法吗?干杯

4

1 回答 1

1

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

于 2013-07-01T11:41:50.750 回答