我是Node的新手,在为节点项目成功运行NPM init之后,尝试通过以下方式安装lodash:
npm install lodash --save
然而,在运行该命令后,我收到错误:
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'internal/fs'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/johnwolfe/.npm/_logs/2018-01-07T05_07_16_644Z-debug.log
我也尝试过运行NPM安装,但我得到了同样的错误。对于此错误有什么可能的解释,我该如何解决?我在网上尝试了其他解决方案,没有任何工作。
这是我的package.json文件:
{
"name": "notes",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
感谢您的任何见解!
答案 0 :(得分:2)
尝试以下方法,
删除项目的所有依赖项。 重新安装。
rm -rf node_modules
npm install
答案 1 :(得分:0)
我最终必须在此线程How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)之后对Node进行深度卸载,然后在解决符号链接问题后再次运行Brew安装节点。
答案 2 :(得分:0)
在我的情况下,安装过程出现问题,因为我的intelliJ没有足够的权限在项目工作区中创建文件夹,请按照以下步骤操作,以解决我的问题,
i)以管理员模式运行IntelliJ,但是在重新启动后该实例仍在工作,我不得不重新启动IntelliJ,这很头疼。
ii)将我的工作区移动到IntelliJ可以访问的路径(早期的工作区在users目录下,这导致了权限问题)。
答案 3 :(得分:0)
我试图使用webpack启动React应用程序。 即使手动安装,我也找不到模块错误。error message even after installing the module
但是“ npm install”也给出了以下建议,以运行“ npm audit fix” npm suggestion