我一直在研究这个 React 项目,几个月以来没有遇到过这个错误。我没有对项目树中 index.html 文件的位置进行任何更改,这就是我无法解释此错误的原因。
我尝试了以下措施但没有成功:
请找出终端显示的错误:
Could not find a required file.
Name: index.html
Searched in: /Users/Sujay/Documents/Documents/Learn Web Development the Hard Way/lacapsule/project/Dark Sky Map Bitbucket/darkskymap_frontend/public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is …Run Code Online (Sandbox Code Playgroud) 我刚刚将我的应用程序从 Expo SDK 37.0.0 升级到 38.0.0。该应用程序在 iOS 上运行良好,但在 Android 上我收到以下警告,并且该应用程序无法在地图上对我进行地理定位。
开发环境:
预期结果:应用程序应根据我的位置对我(用户)进行地理定位。实际结果:应用程序不会根据我的位置对我(用户)进行地理定位。警告 :
[未处理的承诺拒绝:错误:位置提供商不可用。确保定位服务已启用。]
到目前为止我尝试过什么?
再次运行 expo 升级以确保所有软件包都设置为正确的版本。
删除 package-lock.json 和 node_modules 并运行 npm install。
设置 Location.getCurrentPositionAsync({accuracy:Location.Accuracy.High})
设置 Location.getCurrentPositionAsync({ enableHighAccuracy: true })
import * as Location from 'expo-location';
import * as Permissions from 'expo-permissions';
async _getLocationAsync() {
let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted') {
/* If user hasn't granted permission to geolocate …Run Code Online (Sandbox Code Playgroud)