简体   繁体   English

在使用npm install在node.js中启动项目时感到困惑

[英]Confused in starting a project in node.js with npm install

Hello I am just a noob and still learning. 您好,我只是菜鸟,还在学习。 I have already downloaded and tried the chat tutorial of get-started part from socket.io . 我已经从socket.io下载并尝试了入门部分的聊天教程。 Now, I am again learning from another source. 现在,我再次从另一个来源学习。 What's confusing me is that, do I always have to npm install in the beginning of every project after writing the dependencies in the package.json? 令我感到困惑的是,在package.json中写入依赖项后,我是否总是必须在每个项目的开始处都进行npm install吗? Or is there any other way? 还是还有其他方法? I would be very glad if you could help me understand my confusion. 如果您能帮助我理解我的困惑,我将非常高兴。 Thank you! 谢谢!

Yes, before running, all dependencies must be installed. 是的,在运行之前,必须安装所有依赖项。 So you must run npm install . 因此,您必须运行npm install

When developing, you can use npm install --save <package_name> to install a dependency and automatically add it to package.json . 开发时,可以使用npm install --save <package_name>来安装依赖项并将其自动添加到package.json

NPM means Node Package Manager. NPM表示节点软件包管理器。 It is used to manage your dependencies to other node modules dynamically thanks to a configuration file called package.json . 多亏了名为package.json的配置文件,它用于动态管理对其他节点模块的依赖关系。 This way you can easily define the exact versions you need or a mask in order to always retrieve the stable ones for instance. 这样,您可以轻松定义所需的确切版本或掩码,以便始终检索稳定的版本。

The command npm install allows to interpret your configuration file and then download the good versions (and this recursively). 命令npm install允许解释您的配置文件,然后下载良好版本(并递归下载)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM