eclipse开发node遇到问题
发布于 12 年前 作者 smartyin 5453 次浏览 最后一次编辑是 8 年前

使用eclipse开发node项目,全局安装node+express后,在项目文件夹中新建源文件app-node.js,命令行运行"node app-node.js"提示require(‘express’)不成功。求指导!欢迎使用eclipse开发node的同行赐教!

7 回复

你的express安装时有没有加-g

nodeclipse 这个插件还在完善中,可以试用一下。

@smartyin 不是吧,用绝对路径试下。

@sumory 多谢了。实际上是没有将依赖的库加到项目文件夹中。

解决了。总结一下在eclipse下开发node注意的问题: (1)全局安装modules,一般使用的命令是npm install express -g; (2)将安装好的模块文件夹放入到项目中,例如将文件夹C:\Program Files\nodejs\node_modules\express拷贝到项目withexpress中; 相关截图: enter image description here

enter image description here

enter image description here

和使用java开发时,利用maven依赖管理jar包有些不同的地方。

是不是 你没有 cd ./ npm install -d 的原因啊.

回到顶部