Getting the following error while executing expo init command

爱⌒轻易说出口 提交于 2019-12-17 17:22:08

问题


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.

回答1:


Please make sure, that you have git installed. NPM requires git for installing some of the packages. You can check if git is installed via:

git --version

If so, according to the reported issue, removing and reinstalling node_modules should help:

rm -rf node_modules && npm install

You can also try to resolve the issue with yarn:

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



回答2:


It appears to be a core-js version issue.

In package.json, check "expo-core": "version" and if it is lower than the error:You correct the version to fit the error.

and rm -rf node_modules && npm install

or

npm install -g expo-cli

Once you've done it, try running a new expo init.




回答3:


Just check that you've git installed on your system. otherwise, download it

Install git from here - https://git-scm.com/downloads

Your problem will be solved cheers! :)




回答4:


The default expo-template-blank template points react-native to their own Github repo - installing from a Github repo might cause the NPM to hang or err out for various reasons.

To work around this ctrl-c to interrupt initialization when it proceeds to install the dependencies after the project scaffolding is done, edit the package.json to install react-native from the NPM registry - for example this is how my dependencies look:

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

Then manually do npm i to install the dependencies and enjoy.



来源:https://stackoverflow.com/questions/55450764/getting-the-following-error-while-executing-expo-init-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!