首页 > 解决方案 > 面临错误 (0 , (_wordwrap || _load_wordwrap(...)).default)(...)(...).trimStart 不是 expo init 上的函数

问题描述

我正在尝试使用Expo创建本机应用程序。根据 react native 官方文档,我已经在我的 windows 系统上安装了 Node 8+ (v8.12.0) & expo-cli 然后运行 ​​command expo init AwesomeProject。但它给出的错误为

(0 , (_wordwrap || _load_wordwrap(...)).default)(...)(...).trimStart is not a function
Set EXPO_DEBUG=true in your env to view the stack trace.

当我启用世博调试时,它的给予

TypeError: (0 , (_wordwrap || _load_wordwrap(...)).default)(...)(...).trimStart
is not a function
    at C:\expo-cli@2.11.6\src\commands\init.js:105:19
    at Array.map (<anonymous>)
    at _callee$ (C:\expo-cli@2.11.6\src\commands\init.js:95:37)
    at tryCatch (C:\Users\shubhamt1\AppData\Roaming\npm\node_modules\expo-cli\no
de_modules\regenerator-runtime\runtime.js:62:40)
    at Generator.invoke [as _invoke] (C:\Users\shubhamt1\AppData\Roaming\npm\nod
e_modules\expo-cli\node_modules\regenerator-runtime\runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (C:\Users\shubhamt1\Ap
pData\Roaming\npm\node_modules\expo-cli\node_modules\regenerator-runtime\runtime
.js:114:21)
    at step (C:\Users\shubhamt1\AppData\Roaming\npm\node_modules\expo-cli\node_m
odules\babel-runtime\helpers\asyncToGenerator.js:17:30)
    at C:\Users\shubhamt1\AppData\Roaming\npm\node_modules\expo-cli\node_modules
\babel-runtime\helpers\asyncToGenerator.js:35:14
    at new Promise (<anonymous>)
    at new F (C:\Users\shubhamt1\AppData\Roaming\npm\node_modules\expo-cli\node_
modules\core-js\library\modules\_export.js:36:28)

请帮助解决这个问题。我错过了什么?

标签: javascriptnode.jsreactjsreact-nativeexpo

解决方案


你要做的基本上是将expo客户端更新到2.6.11,然后将node.js更新到大于10.0的版本(10或更高版本)并安装git。之后,运行命令

expo init <app-name>

根据世博会文档

您需要在计算机上安装 Node.js(版本 10 或更高版本)。下载最新版本的 Node.js。此外,您需要 Git 来使用 Expo CLI 创建新项目

请参阅Getting Started-React Native以获得全面的指南。


推荐阅读