npm 卸载后 Express 包仍然“需要”吗?
npm uninstallexpress
成功卸载了express,当我ls $NODE_PATH
时,它已经不存在了。
但是,如果我运行 node
和 require('express')
,我会明白
{ version: '1.0.0rc2',
Server: { [Function: Server] super_: { [Function: Server] super_: [Object] } },
createServer: [Function] }
为什么还会发生这种情况?
我使用 Express 的原因是(显然)它与 Connect 的某个版本不兼容。有谁知道 Express 和 Connect 的成功组合会发挥什么作用?
谢谢!
npm uninstall express
successfully uninstalls express, and when I ls $NODE_PATH
, it isn't there anymore.
However, if I run node
and require('express')
, I get
{ version: '1.0.0rc2',
Server: { [Function: Server] super_: { [Function: Server] super_: [Object] } },
createServer: [Function] }
Why does this still happen?
The reason I'm playing around with Express is because (apparently) it breaks with a certain version of Connect. Does anyone know what successful combination of Express and Connect will work ?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
输出 require 路径
console.log(require.paths)
这些是 Nodejs 用于解析
require('express')
的路径Output the require paths
console.log(require.paths)
Those are the paths nodejs is using to resolve the
require('express')
尝试
npm config get root
— 它会显示 npm 安装的位置。如果它指向的某个地方没有意义,请使用 npm config set root [new path] 将其更改为 Node 的 require.paths 中的内容。 (当然,现在您必须重新安装所有 npm 软件包。)Try
npm config get root
—that shows you where npm is installing things. If it's pointing somewhere that doesn't make sense, usenpm config set root [new path]
to change it to something that's in Node'srequire.paths
. (Of course, now you'll have to reinstall all of your npm packages.)我目前使用最新的节点,[email protected],[电子邮件受保护]。我在升级到最新的 connect/express 时遇到了一些问题,所以我发誓要先完成我的应用程序的构建,然后再进行大规模升级。不过这个组合对我来说效果很好。
I currently use latest node, [email protected], [email protected]. I've been having some issues with upgrading to the latest connect/express, so I vowed to finish building my app first and then perform a massive upgrade. This combo works well for me though.