开发过程中需要用到mobx,根据官网的指令安装依赖运行之后,一直报错:Error: Unable to resolve module mobx-react from E:\uploadCode\update\test\app\App.js: mobx-react could not be found within the project or in these directories:
node_modules
…\ node_modules
最开始我以为是下载的时候网络不好,没有下载完全,所以把刚才安装的卸载掉,又重新安装了一遍,但是还有这个错误。
然后在网上百度也百度不到解决办法
最后我只能看看报错信息看有没有办法,最后这句话引起了我的注意:mobx-react could not be found within the project or in these directories:
node_modules
…\ node_modules
说在node_modules和…\ node_modules文件夹里面找不到mobx-react ,于是我进入这两个文件夹里面看,发现…\ node_modules这个文件夹里面有我刚才下载的内容,但是node_modules里面没有,于是我从终端进入node_modules文件夹里面,重新下载安装依赖。
下载完毕后重新运行项目就不会报错了。
总结:哪个文件夹里面没有你下载的依赖,就进入相应文件夹重新下载一遍,使得报错信息里面提到的文件夹都有你下载的依赖