节点错误:找不到模块“./lib/querystring"

问题描述:

我在尝试运行时不断收到以下错误

I keep getting the following error when trying to run

node ./bin/www

Error: Cannot find module './lib/querystring'
    at Function.Module._resolveFilename (module.js:327:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at Object.<anonymous> (/Users/dfranc3373/Project/node_modules/request/request.js:22:19)
    at Module._compile (module.js:399:26)
    at Object.Module._extensions..js (module.js:406:10)
    at Module.load (module.js:345:32)
    at Function.Module._load (module.js:302:12)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)

无论我怎么尝试,我都无法让它运行.

No matter what I try I cannot get it to run.

我已经尝试全局安装查询字符串,我已经完成了 npm 清除缓存,我已经设置了一个 npm 链接,我已经重新安装了 npm 和节点,但仍然没有运气.

I've tried to install querystring globally, I've done npm clear cache, I've set a npm link to it, and I've reinstalled npm and node and still no luck.

有什么想法吗?

感谢 @KevinB 帮助寻找解决方案.我的一个模块没有正确安装.

Thanks to @KevinB for help finding the solution. One of my modules did not install correctly.

首先删除你的 node_modules 文件夹

First delete your node_modules folder

sudo rm -R ./node_modules

在有问题的模块上确保并运行 npm uninstall 之后(显示在 Object. (/Users/dfranc3373/Project/node_modules/request/request.js:22:19))

After make sure and run a npm uninstall on the module that has a problem (shown at Object.<anonymous> (/Users/dfranc3373/Project/node_modules/request/request.js:22:19))

npm uninstall request

然后运行npm cache clean

最后运行 npm update;npm install --save