linux - node.js, npm commands not working -


i have fresh installation of node.js running plesk onynx (linux centos 6).

i can run following command check version.

/opt/plesk/node/7/bin/npm npm --version

this tells me npm working.

however cannot run of main commands, ie npm npm install , npm config, npm init , on.

when try run of above commands following message:

usage: npm

where 1 of: access, adduser, bin, bugs, c, cache, completion, config, ddp, dedupe, deprecate, dist-tag, docs, edit, explore, get, help, help-search, i, init, install, install-test, it, link, list, ln, login, logout, ls, outdated, owner, pack, ping, prefix, prune, publish, rb, rebuild, repo, restart, root, run, run-script, s, se, search, set, shrinkwrap, star, stars, start, stop, t, team, test, tst, un, uninstall, unpublish, unstar, up, update, v, version, view, whoami

npm -h quick on npm -l display full usage info npm search on npm npm involved overview

specify configs in ini-formatted file: /root/.npmrc or on command line via: npm --key value config info can viewed via: npm config

npm@4.0.5 /opt/plesk/node/7/lib/node_modules/npm /$ /opt/plesk/node/7/lib/node_modules/npm npm install mongodb7

any appreciated

everything seems working ok. thing should keep in mind npm node.js' tool means can utilize needs connected node (just pip on python or bundler in ror). can following:

  1. install express.js. first thing should have when comes working in node.js. run:

    npm install express-generator -g 

    this install express globally means on system , not on app (your problem appearing because tried install node module not in directory application).

  2. then create directory plan work application , go there:

    mkdir yournewapp && cd "$_" 
  3. now when have working directory can use express generator create skeleton app. run following command inside yournewapp directory (in since ran cd yournewapp). can choose parameters using non-default stylesheet engine or ejs instead of jade. more information use --help parameter command:

    express   
  4. now when have working skeleton go app.js , specify modules you're planning use. after run:

    npm install 

    and install modules mentioned in app.js.

  5. after can run app locally see if works:

    npm start 

voilĂ .


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -