Javascript 找不到模块';反应自然';
在设置流程后,精确地进行eslint和prettir(但如果有必要,使用纱线代替npm)。我要么在“react native”(安装flow typed后就会消失)上发现模块未找到错误,要么react native的“Libraries”中名为“react native implementation.js”的文件在“cannot fine module‘不变量’、‘warnOnce’、‘ActivityIndicator’”的几乎每一行上都有错误 即使在安装了“flow typed”并添加了存根之后,App.js中的错误也会消失,但应用程序无法在Metro服务器上抛出此错误Javascript 找不到模块';反应自然';,javascript,react-native,eslint,flowtype,Javascript,React Native,Eslint,Flowtype,在设置流程后,精确地进行eslint和prettir(但如果有必要,使用纱线代替npm)。我要么在“react native”(安装flow typed后就会消失)上发现模块未找到错误,要么react native的“Libraries”中名为“react native implementation.js”的文件在“cannot fine module‘不变量’、‘warnOnce’、‘ActivityIndicator’”的几乎每一行上都有错误 即使在安装了“flow typed”并添加了存根
error: bundling failed: Error: Cannot find module 'babel-preset-react-native' from 'C:\PropertyFinder'
- If you want to resolve "react-native", use "module:react-native"
at Function.module.exports [as sync] (C:\PropertyFinder\node_modules\resolve\lib\sync.js:58:15)
at resolveStandardizedName (C:\PropertyFinder\node_modules\@babel\core\lib\config\files\plugins.js:101:31)
at resolvePreset (C:\PropertyFinder\node_modules\@babel\core\lib\config\files\plugins.js:58:10)
at loadPreset (C:\PropertyFinder\node_modules\@babel\core\lib\config\files\plugins.js:77:20)
at createDescriptor (C:\PropertyFinder\node_modules\@babel\core\lib\config\config-descriptors.js:154:9)
at items.map (C:\PropertyFinder\node_modules\@babel\core\lib\config\config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (C:\PropertyFinder\node_modules\@babel\core\lib\config\config-descriptors.js:109:29)
at createPresetDescriptors (C:\PropertyFinder\node_modules\@babel\core\lib\config\config-descriptors.js:101:10)
错误:绑定失败:错误:无法从“C:\PropertyFinder”中找到模块“babel preset react native”
-如果要解析“react-native”,请使用“模块:react-native”
在Function.module.exports[作为同步](C:\PropertyFinder\node\u modules\resolve\lib\sync.js:58:15)
在resolveStandardizedName(C:\PropertyFinder\node\u modules\@babel\core\lib\config\files\plugins.js:101:31)
在resolvePreset(C:\PropertyFinder\node\u modules\@babel\core\lib\config\files\plugins.js:58:10)中
在loadPreset(C:\PropertyFinder\node\u modules\@babel\core\lib\config\files\plugins.js:77:20)处
在createDescriptor(C:\PropertyFinder\node\u modules\@babel\core\lib\config\config descriptors.js:154:9)
在items.map(C:\PropertyFinder\node\u modules\@babel\core\lib\config\config descriptors.js:109:50)
在Array.map()处
在createDescriptors(C:\PropertyFinder\node\u modules\@babel\core\lib\config\config descriptors.js:109:29)
在createPresetDescriptors(C:\PropertyFinder\node\u modules\@babel\core\lib\config\config descriptors.js:101:10)中
这不仅来自我的旧项目,也是复制的项目,我需要更好的智能感知流程。npm问题的标准修复程序
$ rm -rf node_modules
$ npm cache clean -f
$ npm install
您是Thread用户,请尝试删除旧的node_modules文件夹并重新运行安装。我已修复错误,以下是我执行的步骤(可能会有改进): 1.到目前为止,flow的bin版本是
0.97.0
,react native生产^0.92.0
,因此在.flowconfig
中,我将其更改为^0.97.0
2.现在在您的项目根目录中创建一个文件flowLibs.js(或任何真正的文件)。
在[libs]下的.flowconfig中粘贴。/flowLibs.js并粘贴
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/flowLibs.js
或者,如果您对另一个模块有问题,则将react native替换为您的模块。
这还修复了无法解析模块“react native”的错误
注意:您不需要安装流动箱
原因是流类型包含在react native中
如果您已在vs代码上安装了flow language support extension,则flow bin客户端的最新版本已经存在,即从现在的0.97.0开始
declare module "react-native" { declare module.exports: any; }