npm start命令在响应本机中给出错误

时间:2019-09-25 19:59:35

标签: react-native expo

I have been using /programming react native app since last 2 months.
Always it used to work fine , I could code and run the simulator on my iphone . The environment details are as follows:
EXPO --version 3.1.2 ,     npm -v 6.9.0,     node -v12.4.0

突然之间,昨天,当我通过命令“ expo start”启动项目时,它没有启动,但提示未安装expo。因此,我安装了expo cli。

现在,我键入命令“ expo start”,但是它给出了错误 它会打开“地铁”生成器,但会因错误而停止

I am unable to start the project and continue coding the app

I tried following troubleshooting :
removed 'node_modules' folder , re-installed 'npm install' 
however the same issue persists.



Expected:
The project should start , I should be able to run the simulator in phone

Actual:
The project did not start with 'expo start' 
Microsoft Windows [Version 10.0.17134.1006]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\Jituni>cd C:\Users\Jituni\bholmentorworld

C:\Users\Jituni\bholmentorworld>expo start
Starting project at C:\Users\Jituni\bholmentorworld
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
Error: Can't find react-native in package.json dependencies
Error: React Native is not installed. Please run `npm install` in your project directory.
Couldn't start project. Please fix the errors and restart the project.
Set EXPO_DEBUG=true in your env to view the stack trace.

这是依赖项。

{
  "dependencies": {
    "eslint": "^6.2.1",
    "expo": "^33.0.0",
    "firebase": "^6.4.0",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native-gesture-handler": "^1.2.2",
    "react-native-reanimated": "^1.0.1",
    "react-native-web": "^0.11.4",
    "react-navigation": "^3.11.1"
  }
}

2 个答案:

答案 0 :(得分:0)

您尚未在自己的依赖项中安装react-native。

解决方案

您应该使用expo-cli创建新项目。

第一,运行此命令-> expo init projectname 在此步骤中,选择空白项目选择。 然后您可以看到生成的项目。

SECOND ,合并依赖项。然后运行npm installyarn install

LAST ,使用npm startyarn start运行react-native项目。

答案 1 :(得分:0)

我认为您尝试更新EXPO或缺少某些库。 运行命令“ npm install -g expo-cli”。 然后使用命令'expo init Project_Name'创建一个新项目,并选择空白项目选项。然后运行“ npm start”。