我无法在 Mac 上安装模块 Serialport。因此,无法通过 Johnny-5 将 Arduino 与我的计算机连接起来。它说这个错误:
gyp: /Users/me/.node-gyp/4.0.0/common.gypi not found (cwd: /usr/local/lib/node_modules/serialport) 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/node-gyp/lib/configure.js:357:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64/serialport.node" "--module_name=serialport" "--module_path=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64"
gyp ERR! cwd /usr/local/lib/node_modules/serialport
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v2.0.2
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/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:817:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 14.5.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/serialport
node-pre-gyp ERR! node -v v4.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.7
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64' (1)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "serialport" "-g"
npm ERR! node v4.0.0
npm ERR! npm v2.14.2
npm ERR! code ELIFECYCLE
npm ERR! serialport@1.7.4 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@1.7.4 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport 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 serialport
npm ERR! There is likely additional logging output above.
我尝试在本地、全局安装它,查找解决方案,但没有任何帮助。可能是因为我最近更新到 NodeJS 4.0.0。但是我尝试降级它,结果仍然是一样的。安装了 Visual Studio 和 Python(版本 2.x)(在许多不工作的“解决方案”中建议使用)。
你知道如何解决它吗?非常感谢。