Setting up node.js on Ubuntu 12.04 (with eclipse/nodeclipse/enide) - node.js

I'm trying to set up node.js on my Ubuntu 12.04 machine. I want to be able to use it through Eclipse but the process seems confusing.
So far what I have done.
Installed node.js. Shows v5.8.0 on running 'node -v'
Installed npm. Shows 3.7.3 on running 'npm -v'
Installed Express using 'npm install -g express'
Added this to my .bashrc file (I've installed node in ~/node)
export PATH=$HOME/node/bin:$PATH
export NODE_PATH=$HOME/node/lib/node_modules
I'm confused about what to do next. I installed Enide Studio 2015 through Eclipse Marketplace.
Switched to the Node perspective.
Created a new Node.js Express Project
But now I don't see the node project structure.
I also get a bunch of errors like:
- Node.js executable can't be found
What am I doing wrong, or what have I not done?
Alternatively, I installed the linux version of enide from here: http://www.nodeclipse.org/
This contains an eclipse file, but on trying to open the eclipse file it says "there is no application installed for executable files". That's strange because my regular install of eclipse opens just fine. Also I'm running a 32 bit system so I've ensured the files are 32 bit, not 64 bit.
Please help!

if you have node and npm working do the following:
Install express generator:
sudo npm install express-generator -g
Read the documentation about the express generator at http://expressjs.com/en/starter/generator.html
Create an express application:
express myapp
Install dependencies:
cd myapp
npm install
Run the application:
npm start
or
node ./bin/www
Open you browser and navigate to http://localhost:3000

Ok figured it out. I had to set up the node.js path in Eclipse under Preferences>Nodeclipse.

Related

Node wont update, despite downloading and installing latest versions

I am trying to create a new React app with create-react-app. However, when I ran npx create-react-app my-app I got an error:
npx: installed 67 in 8.408s You are running Node 12.22.0.
No worries, I went to the node.js site and downloaded and installed the latest version (18.1.0) and tried again, but got the same error.
Running node -v says I'm still using 12.22.-0.
So I tried npm install -g node --force. Install went fine, but again running node -v still says I'm using 12.22.0 and create-react-app wont work.
I am on Mac OS.
What can I do?
Node isn't installed via npm.
You need to either install Node via the official Mac OS installer, or via Brew (Recommended if you need more than one version)
https://nodejs.org/en/download/ - Download the Mac OS installer that suits your OS Version.

Using Visual Studio Code on MacOS "Error: No default engine was specified and no extension was provided."

Scenario/Setup:
MacOS High Sierra 10.13.6 with new install of VSCode 1.50.0
Following/running VSCode Node Tutorial from: https://code.visualstudio.com/docs/nodejs/nodejs-tutorial
Jump to "Express Application" section
install Express as directed using npm install -g express-generator
build app as directed using express myExpressApp --view pug
run app using npm start but app / web server fails to run with error in terminal
Error:
Error: No default engine was specified and no extension was provided.
System Details:
New install of VSCode 1.50.1
MacOS High Sierra 10.13.6
Seems that pug view rendering engine NOT INSTALLED locally as a depency, even though I installed Express globally with npm install -g express-generator
Fix
run a terminal window, or press CTRL-`(backtick) from inside of Visual Studio Code
cd into your project directory/folder - or already there if launched the terminal from VSCode (previous step)... from there run these commands:
install pug as a local dependency with npm install pug
for EXTRA good measure, re-install express locally with: npm install express
ensure all dependencies are installed and updated using: npm install
relaunch your application with: npm start
test/view your application at: http://localhost:3000

Problems installing GULP on Windows 10 as a limited user

I am trying to install gulp on my development Windows 10 Pro machine and it is not working. I have installed node.js and when I use my admin account I can run gulp. However, when I am not an admin, Windows cannot find the library.
Additional details:
I have looked at Can't install gulp on windows 10 and have searched the web with no luck.
Using Visual Studio 2015 and the project uses gulp to generate css sass and minify js files.
When I run npm install gulp -g -verbose I get (eventually) the following output:
Have you tried cleaning npm cache. use
npm cache clean
And if that doesn't work try installing gulp locally just for that project.
npm install gulp
The screenshot you provided, there is one line where is written that you have not correctly created json file.
package.json should be actual JSON not JavaScript
can you provide your package.json file?

express not installed on my machine

I downloaded node.js onto my linux fedora core 18 machine.
After that using npm -g install express installed express. The problem is I am unable to find the express file to be supplied to Nodeclipse in the preference.
Hence, my application using express is not able to compile saying express not found.
Am I missing anything here?
try installing it with this command and see if it works:
npm install -g express
then go to cd myapp
npm link express
this could do the trick..
Nodeclipse is using express executable only for wizard. Everything else works as for node.js from command line (try node myapp.js)
As advised by #isaacs in Express module not found when installed with NPM, do npm install express for local project folder.

npm install jsdom error on windows?

I have installed nodejs on my windows pc. And it was working fine. But when I tried to install jsdom using
"npm install jsdom" I was prompoted by this error.
node "C:\Program
Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js"
rebuild info it
worked if it ends with ok
ERR! Error: Python does not seem to be installed
at failNoPython (C:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:78:14)
at Object.oncomplete (C:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:66:11)
ERR! not ok
npm WARN optional dependency failed, continuing contextify#0.1.2
jsdom#0.2.13 ./node_modules/jsdom
+-- cssom#0.2.3 +-- htmlparser#1.7.5
Can anyone help me regarding this problem?
I had the same issue on Windows 7 (x64 Ultimate), after hours of search and trials, here is how I resolved it. Please follow the steps in the same exact order:
Install Visual Studio 2010/2012 C++ (Express or higher)
Install Windows SDK 7.1
Install "Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1"
Install GTK (C:\GTK)
Install Python (C:\Python27)
Install node.js (x86)
Add [node.js] to path (C:\Program Files (x86)\nodejs\;)
Add [python] to path (C:\Python27\;)
Add [GTK] to path (C:\GTK\bin;)
Add [WindowsSDKDir] System Variable pointing to "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin"
Run "Windows SDK 7.1 Command Prompt" as Administrator
Set environment to x86 using "setenv /x86"
Change directory to "C:\Program Files (x86)\nodejs\"
Run "npm install -g npm"
Run "npm update -g npm"
Run "npm install -g node-gyp"
Run "node-gyp configure build"
Run "npm install jsdom"
Run "npm install ajax"
Run "npm install http-server"
Run "npm install jquery"
Run "npm install xmlhttprequest"
Run "npm update"
I hope this helps.
There is a nice guide to getting JSDom working on Windows here: http://www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/
jsdom has a dependency on contextify, which only recently supports windows. You'll need python and a C++ compiler to install it.
You may also need to do the following
npm install -g node-gyp
node-gyp configure
For windows 8 64-bit, installing zmq and protobuf, the following worked for me:
First, Install Visual Studio 2012
Then, on the command prompt (in your project directory):
SET VisualStudioVersion=11.0
npm install zmq
npm install protobuf
npm install jsdom
jsdom uses contextify for running JavaScript on the DOM. And contextify requires native C++ compiler. According to the official readme, on Windows platform, one has to install:
A recent copy of the x86 version of Node.js for Windows, not the x64 version. (should be okay by default)
A copy of Visual C++ 2010 Express. (or any newer version)
A copy of Python 2.7, installed in the default location of C:\Python27.
If you have python installed already, you would need to add the python install directory to the PATH environment variable.
Assuming that python.exe is in the C:\Python32\ directory, on the DOS prompt you need to type:
set PATH=%PATH%;C:\Python32\;
and then:
node-gyp configure
should work fine without that error.
After almost a half year of solving this issue, reading all forums related to this, I finally found the solution.
What I did was simple in my case because I don't use many apps on this computer.
My Windows 8.1 had many programs installed which confused the NodeJS probably (Frameworks, VS addons, etc.).
So I simply did this:
Removed all programs from MS, that I installed once.
Uninstalled Nodejs
For sure I cleaned the registry with CCleaner
Removed Python, Node-gyp and other apps related to Node.js
Then I reinstalled Node.js with optimism for JSdom which installed correctly, but crashed while running my project. So I searched for the new error which - again - has a simple solution. I had to install an older version of JSdom.
npm install jsdom#4.2.0
Finally, everything works. Hope that helps anyone with this issue.

Resources