METRO BUNDLER 错误:Metro 遇到错误:无法读取未定义的属性(读取“transformfile”)

ken*_*ard 7 bundler node.js node-modules react-native metro-bundler

我不知道为什么会这样显示,问题发生在 Bundler.js 上,错误指向这一行。

TransformFile(filePath, transformOptions) {
    var _this3 = this;

    return _asyncToGenerator(function*() {
      // We need to be sure that the DependencyGraph has been initialized.
      // TODO: Remove this ugly hack!
      yield _this3._depGraphPromise;
      return _this3._transformer.transformFile(filePath, transformOptions);
    })();

Run Code Online (Sandbox Code Playgroud)

补充一点可能很重要,我是通过 nvm 安装节点的。

谢谢你!

小智 3

就我而言,通过使用较低的节点版本解决了这个问题。尝试一下nvm use 16.14.0(16.14.0 是最新的 lts 版本。)