【问题标题】:Facing error (0 , (_wordwrap || _load_wordwrap(...)).default)(...)(...).trimStart is not a function on expo init面临错误 (0 , (_wordwrap || _load_wordwrap(...)).default)(...)(...).trimStart 不是 expo init 上的函数
【发布时间】:2019-07-23 04:11:48
【问题描述】:

我正在尝试使用 Expo 创建反应原生应用程序。根据 react native 官方文档,我已经在我的 Windows 系统上安装了 Node 8+ (v8.12.0) 和 expo-cli,然后运行命令 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.

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

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)

请帮忙。我错过了什么?

【问题讨论】:

  • 降级版本有效。现在我使用的是 2.11.6
  • 谢谢。它也对我有用
  • 刚刚使用 Node 8.11、yarn v1.12 和 2.11.3 进行了测试,如下面的海报所述。我在 2.11.3 中没有看到错误。
  • 我将 nodejs 版本更新为最新版本 (10.15.2),这为不想降级 expo 版本的任何人解决了这个问题

标签: javascript node.js reactjs react-native expo


【解决方案1】:

这是 nodejs 版本的问题,您可以安装 nvm 然后轻松更新 node 版本,我更新到版本 10.15 并且它可以工作: Installing NVM at ubuntu

【讨论】:

    【解决方案2】:

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

    expo init &lt;app-name&gt;

    根据Expo docs

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

    有关综合指南,请参阅 Getting Started-React Native

    【讨论】:

      【解决方案3】:

      降级到 2.11.6 对我不起作用:

      ~/Projects/ReactNativeApp (master)
      $ expo --version
      2.11.6
      
      ~/Projects/ReactNativeApp (master)
      $ expo init ReactNativeApp
      [12:07:17] (0 , (_wordwrap || _load_wordwrap(...)).default)(...)(...).trimStart is not a function
      [12:07:17] Set EXPO_DEBUG=true in your env to view the stack trace.
      
      

      我必须降级到 2.11.3 才能跳过此错误。

      我对 2.11.5 和 2.11.4 有同样的问题。

      升级到 node.js 10+ 解决了这个问题。

      【讨论】:

      • 将节点升级到 10+ 为我解决了这个问题
      【解决方案4】:

      使用较低版本的 expo,我认为新版本仍处于测试阶段。

      【讨论】:

        猜你喜欢
        • 2023-01-28
        • 2018-01-08
        • 1970-01-01
        • 2016-03-01
        • 2017-07-27
        • 1970-01-01
        • 2019-03-08
        • 2018-02-10
        • 2016-09-20
        相关资源
        最近更新 更多