Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为Johnny Five在NodeJS(mac)上安装串行端口模块_Javascript_Node.js_Arduino_Node Serialport_Johnny Five - Fatal编程技术网

Javascript 为Johnny Five在NodeJS(mac)上安装串行端口模块

Javascript 为Johnny Five在NodeJS(mac)上安装串行端口模块,javascript,node.js,arduino,node-serialport,johnny-five,Javascript,Node.js,Arduino,Node Serialport,Johnny Five,我无法在Mac上安装模块Serialport。因此,无法通过强尼五号将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 err

我无法在Mac上安装模块Serialport。因此,无法通过强尼五号将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.
试图加载binding.gyp时读取binding.gyp的includes时未找到
gyp:/Users/me/.node gyp/4.0.0/common.gypi(cwd:/usr/local/lib/node_modules/serialport)
哎呀!配置错误
哎呀!堆栈错误:`gyp`失败,退出代码:1
哎呀!在ChildProcess.onCpExit(/usr/local/lib/node_modules/node gyp/lib/configure.js:357:16)处堆栈
哎呀!在emitTwo处堆栈(events.js:87:13)
哎呀!ChildProcess.emit处的堆栈(events.js:172:7)
哎呀!在Process.ChildProcess.\u handle.onexit(internal/child\u Process.js:200:12)处堆栈
哎呀!达尔文系统14.5.0
哎呀!命令“/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
GypErr!节点-v4.0.0
gyp ERR!节点gyp-Vv2.0.2
哎呀!不行
节点预gyp错误!生成错误
node pre-gyp ERR!堆栈错误:未能执行“/usr/local/bin/node/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js configure--fallback to build--modules=/usr/local/lib/node_modules/serialport/build/serialport/v46-darwin-x64/serialport.node--modules_name=serialport--modules_-path=/usr/local/lib/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64'(1)
node pre-gyp ERR!在ChildProcess上堆栈。(/usr/local/lib/node_modules/serialport/node_modules/node pre-gyp/lib/util/compile.js:83:29)
emitTwo上的节点pre-gyp ERR!堆栈(events.js:87:13)
ChildProcess.emit(events.js:172:7)处的节点前gyp ERR!堆栈
maybeClose的节点前gyp ERR!堆栈(internal/child_process.js:817:16)
node pre-gyp ERR!在Process.ChildProcess.\u handle.onexit(internal/child\u Process.js:211:5)处堆栈
节点预gyp错误!系统达尔文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”“--回退到生成”
节点前gyp ERR!cwd/usr/local/lib/node_modules/serialport
节点前gyp错误!节点-v4.0.0
节点预gyp错误!节点预gyp-v v0.6.7
节点预gyp错误!不正常
未能执行“/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--modules_路径=/usr/local/lib/node/serialport/serialport/v1.7.4/Release/node-v46-darwin-x64'(1)
npm ERR!达尔文14.5.0
npm ERR!argv“/usr/local/bin/node”“/usr/local/bin/npm”“i”“serialport”“-g”
npm错误!节点v4.0.0
npm错误!npm v2.14.2
npm错误!代码错误周期
npm错误!serialport@1.7.4install:`node pre-gyp install--回退到构建`
npm错误!退出状态1
npm错误!
npm ERR!在以下位置失败:serialport@1.7.4安装脚本“node pre-gyp install--fallback to build”。
npm ERR!这很可能是serialport包的问题,
npm错误!与npm本身无关。
npm ERR!告诉作者此操作在您的系统上失败:
npm ERR!节点预gyp安装--回退到构建
npm ERR!您可以通过以下方式获取他们的信息:
npm错误!npm所有者ls serialport
npm ERR!上面可能还有其他日志输出。
我尝试在本地、全局安装它,并查找解决方案,但没有任何帮助。可能是因为我最近更新到了NodeJS 4.0.0。但我尝试降级,结果仍然是一样的。安装了Visual Studio和Python(版本2.x)(这是许多不工作的“解决方案”中建议的)


您知道如何解决它吗?非常感谢。

我也有同样的问题。一位同事告诉我使用NVM可能有效。我现在正在解决这个问题。

在回答这个问题时,Node Serialport不支持Node 4.x。您需要安装0.12.x或0.10.x。请按照下面的说明了解详细信息