更新时间:2023-09-13 20:19:16
您不能 require()
个模块在npm中安装了 -g
标志。删除 -g
标志: npm install connect
。 -g
用于安装提供命令行实用程序的模块,例如 express-generator
模块。
You can't require()
modules that you've installed with the -g
flag in npm. Remove the -g
flag: npm install connect
. The -g
is for installing modules that provide command-line utilities, such as the express-generator
module.
此外,您真的不应该在项目中使用 C:\Program Files\nodejs
,因为会安装npm当前工作目录的子目录中的模块...
Also, you really shouldn't use C:\Program Files\nodejs
for your project since npm will install modules in a subdirectory of your current working directory...