[英]do I have to install npm for every new project?
I have NPM installed in my PC how to use it for a new project?我的 PC 上安装了 NPM 如何将其用于新项目?
or do I have to install npm for every new project?还是我必须为每个新项目安装 npm?
NPM is extremely useful, but, when you install it, you install it globally. NPM 非常有用,但是,当您安装它时,您将在全局范围内安装它。 It comes with Node JS, so when you install Node JS, you should have npm installed(type npm -v to see the version and whether npm is installed).
它是Node JS自带的,所以在安装Node JS的时候,你应该已经安装了npm(输入npm -v查看版本以及是否安装了npm)。
"npm init" creates a package.json for your folder, which contains all the information about the version number, the name of the project, and some other information. “npm init”为您的文件夹创建一个 package.json,其中包含有关版本号、项目名称和其他一些信息的所有信息。 In package.json, you can add dependencies, which basically say your project relies on that npm package.
在 package.json 中,您可以添加依赖项,这基本上是说您的项目依赖于该 npm 包。
"npm install" will install all the packages specified in package.json, and, if you want to install something specific, you would type "npm install ". “npm install”将安装 package.json 中指定的所有包,如果你想安装特定的东西,你可以输入“npm install”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.