node.js - react-native 项目创建给出 node-pre-gyp Hit error socket hang up error
问题描述
我正在尝试创建一个项目,但是,它在安装模块react-native
时会引发错误。node-pre-gyp
我正在使用Mac,我也尝试安装了node-pre-gyp
全局。但是,得到同样的错误。
➜ mobile react-native init Demo
This will walk you through creating a new React Native project in /Users/gaurang.shah/Documents/personal/code/mobile/Demo
Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
> fsevents@1.2.7 install /Users/gaurang.shah/Documents/personal/code/mobile/Demo/node_modules/fsevents
> node install
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.7 and node@11.10.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error socket hang up
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
COPY /Users/gaurang.shah/Documents/personal/code/mobile/Demo/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node
TOUCH Release/obj.target/action_after_build.stamp
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-native@0.58.5 requires a peer of react@16.6.3 but none is installed. You must install peer dependencies yourself.
+ react-native@0.58.5
added 733 packages from 381 contributors and audited 27744 packages in 899.043s
found 11 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
解决方案
这可能是由于旧安装的软件包node_modules
与较新版本的 npm 不兼容。尝试使用 删除node_modules
目录rm -rf Demo/node_modules
,然后重试mobile react-native init Demo
。
推荐阅读
- docker - 如何使用多个服务备份 docker?
- shell - 我将几个脚本文件从一个位置移动到另一个位置。我没有提到目的地中那些文件的名称
- java - 如何在spring mvc过滤器或拦截器中修改请求
- r - 是否有一个 R 函数可以从列名矩阵中检索值?
- django - 如何在 Dajngo ORM 中指定 GROUP BY 字段?
- javascript - 如何将 ID 和文件发送到同一个控制器?
- vba - 如何将单击的形状从一张幻灯片复制并粘贴到另一张幻灯片
- sql - SQL查找子级匹配多行的父级
- jquery - 在用户输入中使用 .serialize() 是否安全?
- javascript - 动态 JSON 对象到 Html 表