簡體   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