0

我正在尝试在我的 Macbook Air 上安装 ccxtsudo npm install --save ccxt并遇到以下错误:

> scrypt@6.0.3 preinstall /Applications/Xcode.app/Contents/Developer/Toolchains/node_modules/scrypt
> node node-scrypt-preinstall.js

Error: Error: Command failed: ./configure
configure: error: in `/Applications/Xcode.app/Contents/Developer/Toolchains/node_modules/scrypt/scrypt/scrypt-1.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details


> scrypt@6.0.3 install /Applications/Xcode.app/Contents/Developer/Toolchains/node_modules/scrypt
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/peterpham/anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:275:12)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:346:11)
gyp ERR! stack     at emitOne (events.js:116:13)
gyp ERR! stack     at Socket.emit (events.js:211:7)
gyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:557:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Applications/Xcode.app/Contents/Developer/Toolchains/node_modules/scrypt
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/Applications/Xcode.app/Contents/Developer/Toolchains/package.json'
npm WARN Toolchains No description
npm WARN Toolchains No repository field.
npm WARN Toolchains No README data
npm WARN Toolchains No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/peterpham/.npm/_logs/2018-08-30T04_34_20_141Z-debug.log

我已经安装了 Xcode 9.4.1 并检查了我的命令行工具是否安装在 Preferences > Location 部分,就像在这个其他stackoverflow问题中一样。我还在终端中尝试了以下所有答案,以更改目录和所有权,但无济于事。也尝试过sudo npm install --save scrypt同样的错误。它可能与 anaconda 环境路径有关。

我很确定它与某些配置有关,但我不确定它是什么。如果您需要更多信息,请告诉我,我会发布。我不知道 configure.log 在哪里所以我不能发布它,我也尝试使用在线资源找到它并且迷路了。

4

1 回答 1

1

解决错误的关键是这部分错误代码:

gyp ERR! stack Error: Command failed: /Users/peterpham/anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];

所以我尝试安装python 2.7,但没有成功。因此,我尝试使用 App Cleaner 从我的计算机上卸载 Anaconda,并且成功了。之后我可以运行命令npm install --save ccxt

于 2018-09-10T19:41:17.290 回答