2018-09-18 Mosh nodejs lecture 2

  1. in newer version of npm ,

npm i mongodb

would automatically save dependency info of mongodb into package.json of current nodejs project
only in the older version ,

npm i mongodb -S

is needed

  1. since package.json is automatically update once you run

npm i mongodb

there is no need to change package.json manually.
when you publish your code to git, just

touch .gitignore

and add node_modules/ to it, which would ignore the fodler

node_modules/

when pushing to git.

on the server, just pull the code and run

npm i,

this would install modules requeired base on the package.json file

  1. npm list
    would show all the dependencies in current project, including a tree dependceis

if you do not want such details, run

npm list --depth=0

this only list the modules required by your project , and would not show other modules depended by the former modules.

  1. the dependcies in package.json of any module could be shown by :

npm view mongodb dependencies

this would list the dependencies,while

npm view mongodb

would show all details from package.json of mongodb module

  1. npm outdated

this shows the outdated modules depended by your current project, see SemVersion and Tilda Version

npm outdated -g

shows outdated modules globally

  1. to see the real installed module version, check the packge.json in the project, or the one in the node_modules/PackageName folder

or run

npm list --depth=0

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,448评论 0 10
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,505评论 0 13
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,916评论 0 23
  • 暗恋一个人久了,喜欢的就不是那个人了,而是那种感觉
    蓝忧阅读 180评论 0 1
  • 不少中国女人已经有了自己的房。 1 最近,一则调查显示,2018年,中国购房女性比例达47.9%,基本可以和男性购...
    长祥阅读 300评论 1 5