I am learning node.js and I am trying to run the app.js file using the command node app.js
but the bash returns nothing (no errors either). Here are the steps I followed:
$ brew install node
$ sudo npm install -g express
$ sudo npm install -g express-generator
after i get into a new folder I created I run
$ express testsite --hogan -c less
$ cd testsite && npm install
Finally
$ node app.js
// returns no errors but nothing back except new command line...
Any help on this would be great.
Thanks!
You can Run your JavaScript File from your Terminal only if you have installed NodeJs runtime. If you have Installed it then Simply open the terminal and type “node FileName. js”. If you don't have NodeJs runtime environment then go to NodeJs Runtime Environment Download and Download it.
Make sure the node path is added, if not added it. After doing this restart Visual Studio or open a fresh command prompt. From the command prompt type 'node -v' to echo the node version installed. You can also add the path to node or any other application directly on the command line.
js to structure your JavaScript applications on the client side, you can use Browserify to require JavaScript modules from JavaScript running on the browser. Browsers lack the Node. js platform's require/export and module import systems; therefore, Browserify was developed to make it possible to import Node.
try npm start
from testsite directory.
look at the package.json
scripts : { start : node bin/www }
So you must execute the www under the bin directory.
So instead of node app.js
use node bin/www
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With