CNode

eclipse开发node遇到问题

Ssmartyin发布于14 年前最后回复14 年前7 回复6073 浏览0 收藏

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

查看回复

回复 (7)

S
sumory#1·14 年前

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

J
jin52yang#2·14 年前

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

S
sumory#4·14 年前
引用 sumory你的express安装时有没有加 g

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

S
smartyin#5·14 年前
引用 sumory你的express安装时有没有加 g

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

S
smartyin#6·14 年前

解决了。总结一下在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包有些不同的地方。

R
robinhunter#7·14 年前

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

参与回复
登录后即可参与回复。登录