繁体   English   中英

执行 expo init 命令时出现以下错误

[英]Getting the following error while executing expo init command

Installing dependencies...
npm WARN deprecated core-js@1.2.7: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/expo/react-native-maps.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\SAMSUNG\AppData\Roaming\npm-cache\_logs\2019-04-01T08_16_06_470Z-debug.log
Process exited with non-zero code: 1
Set EXPO_DEBUG=true in your env to view the stack trace.

请确保您已安装 git NPM 需要 git 来安装一些软件包。 您可以通过以下方式检查 git 是否已安装:

git --version

如果是这样,根据报告的问题,删除并重新安装 node_modules 应该会有所帮助:

rm -rf node_modules && npm install

您也可以尝试使用yarn解决问题:

brew install yarn
npm uninstall -g create-react-native-app
yarn global add create-react-native-app

这似乎是一个core-js版本问题。

package.json ,检查"expo-core": "version"如果它低于错误:您更正版本以适应错误。

rm -rf node_modules && npm install

或者

npm install -g expo-cli

完成后,尝试运行一个新的expo init

只需检查您的系统上是否安装了 git。 否则,下载它

从这里安装 git - https://git-scm.com/downloads

你的问题将得到解决干杯! :)

默认的expo-template-blank模板将react-native指向他们自己的 Github 存储库 - 从 Github 存储库安装可能会导致 NPM 由于各种原因挂起或出错。

要解决此ctrl-c以在项目脚手架完成后继续安装依赖项时中断初始化,请编辑package.json以从 NPM 注册表安装react-native - 例如,这是我的依赖项的外观:

 "dependencies": {
    "expo": "^35.0.1",
    "react": "^16.8.3",
    "react-dom": "^16.8.3",
    "react-native": "^0.59.10"
//...

然后手动执行npm i安装依赖项并享受。

这会显示您未安装 git 的情况。 你可以按照上面的任何答案来让它在本地工作。 但是,如果您在部署节点应用程序时遇到此问题,请检查您用于部署的节点映像。 如果它是 node: alpine 那么你会得到这个错误。

要修复它,您可以使用 node:carbon 图像。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM