【问题标题】:Expo project not starting世博项目未启动
【发布时间】:2020-09-01 17:50:59
【问题描述】:

当我尝试使用 npm start 时,我的 expo 项目没有启动。 我使用的版本是

Expo-cli:3.20.5

节点:12.16.3

流程:

展会初始化项目

-> 空白模板

展会开始

运行expo start命令后出现以下错误

Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
ConfigError: Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
    at Object.getExpoSDKVersion (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Project.ts:35:9)
    at ensureConfigHasDefaultValues (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Config.ts:419:22)
    at fillAndReturnConfig (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\config\src\Config.ts:101:10)
    at configureProjectAsync (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:281:25)
    at action (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:157:34)
    at C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:334:16
    at Command.<anonymous> (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:85:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

然后如上面第一行所述,我运行 npm install expo

运行安装 expo 的命令后,出现以下错误


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.
    at startExpoServerAsync (C:\@expo\xdl@57.9.5\src\Project.ts:2080:11)
    at Object.startAsync (C:\@expo\xdl@57.9.5\src\Project.ts:2397:5)
    at action (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:170:3)
    at C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:341:16
    at Command.<anonymous> (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:85:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR! Failed at the @ start script.

然后我运行了上述错误中提到的 npm install ,然后得到了这个错误

npm WARN deprecated deep-assign@3.0.0: Check out `lodash.merge` or `merge-options` instead.
npm WARN deprecated core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file 

之后,当我再次尝试 npm start 时,它会不断重复我上面提到的相同错误

【问题讨论】:

    标签: node.js react-native npm expo


    【解决方案1】:

    问题是 npm install 无法在您的计算机上运行,​​可能是由于某些缓存问题。您可以运行npm cache clean --force,然后再次运行npm install 来尝试解决问题

    【讨论】:

      【解决方案2】:

      Illustration 我遇到了同样的问题并清理了我的节点模块。但是问题又回来了,因为我以错误的方式杀死了我的服务器。所以我再次清理了 repo 并正确关闭了我的服务器。现在我总是正确关闭我的服务器。该问题暂时没有再次发生。

      => 不要杀死你的 cmd,你必须通过 CMD+C for win 10 正确关闭服务器。

      【讨论】:

        猜你喜欢
        • 2020-10-16
        • 1970-01-01
        • 2018-11-13
        • 2023-02-11
        • 1970-01-01
        • 1970-01-01
        • 2022-07-27
        • 2020-12-11
        • 1970-01-01
        相关资源
        最近更新 更多