2018-09-18 Mosh nodejs lecture 2
1550 ワード
npm i mongodb
would automically save dependency info of mongodb into package.json of current nodejs project only in the older version、npm i mongodb -S
is neednpm i mongodb
there isのneed to change package.json manaualy.when you publish your code to git,justtouch .gitignore
and add node_modules/to it,which would ignore the fodlernode_modules/
when pusing to git.
on the server,just pull the code and run
npm i
、this would install modules requeired base on the package.json file
npm list
would show all the dependencies in current project,including a tree dependceis npm list --depth=0
this only list the modules required by your project、and would not show other modules depended by the former modules.npm view mongodb dependencies
this would list the dependencies,whilenpm view mongodb
would show all detail from package.json of mongodb modulenpm outdated
npm outdated -g
shows outdated modules globallynpm list --depth=0