Closed dwwaddell closed 10 years ago
If you set "express" version to "latest" in your project package.json dependencies then NPM will install version 4.9.0 — at the time this was written.
I don't see in what Nodeclipse is concerned by any node module's version as this is mostly a coding issue to me: if your app need Express 4.x.x then install Express 4.x.x with NPM.
I have Express 4.x.x installed but when you create a New Project with Nodeclipse, it creates an Express 3.2.6 project.
{ "name": "test2", "version": "0.0.1", "private": true, "scripts": { "start": "node app.js" }, "dependencies": { "express": "3.2.6", "ejs": "*" } }
There are big differences between Express 3.x.x and 4.x.x that need to be changed in the JavaScript as can be seen when you use express-generator (4.x.x) to create a project (which won’t run under Nodeclipse).
Yes - Express 4 is not using connect middleware anymore: http://expressjs.com/migrating-4.html
When you create a new Express 4 project from express-generator it's not a Nodeclipse project - therefore it won't run as node application from Nodeclipse...
But it didn't run either from a terminal for me here...
$ sudo npm install -g express-generator
$ express myapp
$ cd myapp
$ npm install
$ node -v
$ v0.10.31
$ node app.js
$
Node exits without any output — am I missing something important in this process?
Running it as Node application from Nodeclipse node.js process is just terminated:
Which is not a surprise as it's not a Nodeclipse project (no project resources - etc): in my understanding an Express 4 project would need to be generated by Nodeclipse to be run from Nodeclipse — as a new project type.
You have to start it with “npm start”.
If you look at package.json, you will see how it starts now:
{ "name": "searchPiper", "version": "0.0.1", "private": true, "script": { "start": "node ./bin/www" },
"dependencies": { "body-parser": "~1.8.1", "cookie-parser": "~1.3.3", "debug": "~2.0.0", "ejs": "~0.8.5", "express": "~4.9.0", "mongodb": "^1.4.10", "mongoose": "^3.8.16", "monk": "^0.9.0", "morgan": "~1.3.0", "passport": "^0.2.1", "passport-twitter": "^1.0.2", "serve-favicon": "~2.1.3" } }
$ npm start
Interesting: what about NPMEclipse then ;+)
node ./bin/www
works too:
{ "name": "myapp", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "express": "~4.9.0", "body-parser": "~1.8.1", "cookie-parser": "~1.3.3", "morgan": "~1.3.0", "serve-favicon": "~2.1.3", "debug": "~2.0.0", "jade": "~1.6.0" } }
To summarize, we now have two different issues: 1 - a new project template for Express 4 (connect middleware is now splitted into several modules) 2 - a new "Run As" procedure that loads Express 4 application from ./bin/www
Yes, and that is what you have to put in the Run Configuration to make it work in Eclipse.
I think that will do it. You might want to add the ability to choose between a 3.x and 4.x in the creation process.
How do you set Run Configuration to make it run?
Choose New Configuration, then click Search:
… and start typing “w” and it pops up the matching values:
… choose which folder in “In folders” by double-clicking on it. Or, you can just type in the path i.e. /searchPiper/bin/www
It doen't run for me:
When I click Run at bottom right of this latter panel nothing happens
This doesn’t always work. I have had apps running for hours and then killed them and they won’t restart.
$ cat .project
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>myapp</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> </projectDescription>
It's not a Nodeclipse project: <buildSpec> and <natures> elements are empty — so I don't see how it could run in Nodeclipse...
It has run for me on numerous occasions. It created a .project:
<?xml version="1.0" encoding="UTF-8"?>
So, mine has quit running again. I can’t figure out under what conditions it stops and, more frustrating, what makes it start working again. It is not a complete reboot and it is not creating a New Configuration nor is it starting it in the command line, stopping it, and coming back to Eclipse. When it is running, it is good for several days, typically, before it stops again.
Here it is running again with an External Tools New Configuration:
How do you get the images in the post? I have tried DnD and "Selecting them" but it just puts in a link. When I reply by email, Github just discards the pictures. Dave
as Patrick @nodeleaf said
we now have two different issues:
any other questions, please create an issue per question
Is there support for Express 4.x.x in Nodeclipse?