Node command doesnt work [duplicate] - javascript

This question already has answers here:
nodejs vs node on ubuntu 12.04
(21 answers)
Closed 8 years ago.
I am using ubuntu 14.04 and when i use node hello.js command on terminal nothing happens. I installed the packages using sudo apt-get command. I don't know what is wrong. No error message or anything. I searched for my problem but couldnt find anything.

The problem has to do with package naming. The node package in Debian/Ubuntu is not node.js, it's amateur packet radio software.
My suggestion is that if you want node.js, remove the existing node program (sudo apt-get purge node for Debian/Ubuntu) and follow the instructions here for your particular distro/platform. That should get you the latest stable version, which you should be able to verify with node -v.

Related

Nodemon not reexecuting the chages that i have made locally [duplicate]

This question already has answers here:
How to restart a node.js server
(9 answers)
Closed 3 years ago.
I created a sample node function like hello world. After being executed using the command line node myfirst.js, hello world displayed in the browser. After installing the nodemon it re-execute on small changes, but some times it became stuck and failed to recompile on major changes which needs to restarted. Do i have to install any other npm packages?
Use nodemon
Nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.
Install it with npm install nodemon -g
Execute your app with:
nodemon myfirst.js
Instead of using node myfirst.js
The solution will refresh every time you save your edited code.
I'm not sure I fully get what you need but you could try to use nodemon --> https://www.npmjs.com/package/nodemon
Hope it helps!

JavaScript Program Path Not Specified Error

I've been creating a JavaScript game for a project recently and have done it completely on the CodePen website. I now am trying to transfer it to WebStorm to turn it into a basic website. However when I try to run my code I get the following error:
I don't know how to fix it, I've looked everywhere and haven't been able to get some help. Any information would be appreciated.
Simple one, basically the error says, I don't know how to interpret this bit of code that you just gave me. You're missing local install of Node.js and NPM. Get the latest versions of these 2, and then go to File -> Settings -> Language&Frameworks -> Node.js and NPM and in the Node interpreter text box, point it to the path of where node.js was installed.
You're running this JavaScript file with Node.js that is probably not installed on your machine. It seems that you want to run and debug your app in the browser instead. For that you need to create a JavaScript run/debug configuration instead as described here: https://www.jetbrains.com/help/webstorm/debugging-javascript-in-chrome.html
On a linux machnie,
Install nodejs and npm
sudo apt-get install nodejs
sudo apt-get install npm
Get the nodejs installation folder
whereis nodejs
Should print something like:
/usr/bin/nodejs /usr/lib/nodejs /usr/include/nodejs /usr/share/nodejs /usr/share/man/man1/nodejs.1.gz
Go to:
Webstorm-> File -> Languages & Frameworks -> Node interpreter
Copy paste the installation folder to the text box.
Mac OS here. Solved the issue with:
$ brew install nodejs

what in deference between node and node js? [duplicate]

This question already has answers here:
What are the differences between node.js and node?
(3 answers)
Closed 5 years ago.
I installed nodejs as per this documentation
https://nodejs.org/en/download/package-manager/
then I checked i current version of Node js
:~/Downloads$ nodejs -v
v4.2.6
Still Older version of Nodejs
then I tried to install node via nvm
as per this documentation https://askubuntu.com/questions/849270/how-can-i-install-a-tar-xz-file-from-nodejs-org
I got newest version of Node
:~/Downloads$ node -v
v7.9.0
But When I checked version of nodejs , got still old version of nodejs.
I just confused about difference bewtween nodejs and node .
thanks in advance if any one help me to install latest version of Nodejs via ppa or by tar.xz file, I already tried each solution.
Answers is what are the differences between node.js and node?

How to use npm-check [duplicate]

This question already has answers here:
webpack is not recognized as a internal or external command,operable program or batch file
(25 answers)
Closed 5 years ago.
I have been playing around with node.js and learning by playing with the Spotify API.
Spotify provided example source code which I have been building off but now I want to make my own thing.
There are many modules in node_module for use for their different examples and I obviously don't want any packages I am not using being hosted on my Git so I looking into my options and came across npm-check (https://www.npmjs.com/package/npm-check)
I did
npm install npm-check
and it was successful
I then try to run the npm-check command in the folder my app.js is contained in like so
npm-check
I then get an error saying it is not a recognized command.
what am I missing?
npm install only installs the npm module into the directory you are currently in., After running that command, you should see a node_modules directory with the npm-check module and all of it's dependencies.
To run npm check here, you would need to run /path/to/.bin/npm-check
If you would like to be able to run npm-check from any directory by simply running npm-check, you must first install it globally:
npm install -g npm-check

how to run the express js(node js) in command line - linux [duplicate]

This question already has answers here:
How to run Node.js as a background process and never die?
(14 answers)
Closed 6 years ago.
I had installed the node js, express js and npm to manage my application.
i have created the app using express js. Now I want to the run my express js app in command line in linux. currently i'm using DEBUG=alpha-webtorrent:* npm start to run my app.
I also want to run my app in background for forever.
In your command line run npm install -g pm2 cd o your app,lication and run pm2 start app.js viola your server will run forever and restart if a crash occurs. Documentation for pm2 is here
install a package called forever
npm install forever -g
Go through the documentation to know more about it.
https://www.npmjs.com/package/forever
And then use
forever start filename.js

Categories