Run node script from project path

271 views Asked by At

I am running on win 7 and have installed nodeJS as a path variable.

I have installed a nodeJs module(pusher) in my laravel project and got the following folder structure a folder, when adding a further libary:

enter image description here

I would like to execture my server.js file:

var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');

I tried to navigate into my node_modules folder and do

npm server.js

However, I only get back:

$ npm server.js

Usage: npm <command>

where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, ddp, dedupe, deprecate, docs, edit,
    explore, faq, find, find-dupes, get, help, help-search,
    home, i, info, init, install, isntall, issues, la, link,
    list, ll, ln, login, ls, outdated, owner, pack, prefix,
    prune, publish, r, rb, rebuild, remove, repo, restart, rm,
    root, run-script, s, se, search, set, show, shrinkwrap,
    star, stars, start, stop, submodule, tag, test, tst, un,
    uninstall, unlink, unpublish, unstar, up, update, v,
    version, view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    C:\Users\User\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

[email protected] c:\Program Files (x86)\nodejs\node_modules\npm

Any recommendations what I am doing wrong?

I appreciate your answer!

0

There are 0 answers