NodeJS: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
Line 12: Line 12:
  npm docs ''packagename''
  npm docs ''packagename''


This jumps to a browser and opens the relevant site. For example, "npm docs react" opens https://reactjs.org.
This jumps to a browser and opens the relevant site for ''packagename''. For example, "npm docs react" opens https://reactjs.org.
 
If you publish your own project as a package then it takes you to the npmjs.com site page.
 
 





Revision as of 17:49, 28 November 2018

Stuff I wish I had known a few weeks ago

Setting a browser

I usually use Chrome on Windows and Firefox on Mac. Instead of wiring a browser into my package.json 'start' command with "--open chrome", I now use just "--open" and let it pick. I can set the browser with

npm config set browser {chrome|firefox|lynx}

Reading docs

npm docs packagename

This jumps to a browser and opens the relevant site for packagename. For example, "npm docs react" opens https://reactjs.org. If you publish your own project as a package then it takes you to the npmjs.com site page.