【问题标题】:Cannot find module 'react-transform-hmr/lib/index.js'找不到模块'react-transform-hmr/lib/index.js'
【发布时间】:2018-05-02 19:56:35
【问题描述】:

安装 React native 后,我运行以下命令:

$ react-native init demoApp

得到了这个错误:

Error: Cannot find module 'react-transform-hmr/lib/index.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.require.resolve (internal/module.js:16:19)
at makeMakeHMRConfig7 (/home/local/MPLLC/malwinder.singh/demoApp/node_modules/react-native/node_modules/metro/src/babel-bridge.js:120:31)
at Object.<anonymous> (/home/local/MPLLC/malwinder.singh/demoApp/node_modules/react-native/node_modules/metro/src/babel-bridge.js:49:24)
at Module._compile (module.js:409:26)
at Module._extensions..js (module.js:416:10)
at Object.require.extensions.(anonymous function) [as .js] (/home/local/MPLLC/malwinder.singh/demoApp/node_modules/react-native/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)

我错过了什么?如何解决这个问题?

【问题讨论】:

  • 尝试重新安装 react-native cli
  • 完成。还是不行。
  • 你能找到解决方案吗?我遇到了同样的错误。
  • 是的。我安装了所需的包:create-react-native-app
  • 如果您为我们初学者布拉斯基提供详细的解决方案会很好。

标签: java android react-native kotlin react-native-android


【解决方案1】:
npm install react-transform-hmr

这解决了我的问题

【讨论】:

  • 纱线添加--dev react-transform-hmr
【解决方案2】:

下面的命令为我解决了这个问题

react-native start --reset-cache

【讨论】:

    猜你喜欢
    • 2018-12-30
    • 2019-03-10
    • 1970-01-01
    • 2019-03-03
    • 2019-09-04
    • 2016-03-31
    • 2021-09-21
    • 2021-10-28
    • 2021-12-03
    相关资源
    最近更新 更多