简体   繁体   English

我必须为每个新项目安装 npm 吗?

[英]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.

相关问题 gulp-我必须为每个项目安装插件吗? - gulp - do i have to install plugins for every project? 新建项目时是否应该安装所有 npm 包? - Should I install all the npm packages when making a new project? 在 npm 上发布之前,我是否必须构建 React Javascript 项目? - Do I have to build the React Javascript project before publishing on npm? 我是否必须为每个页面创建一个新面板? - Do I have to create a new panel for every page? 如何在本地 Node.js 服务器上为 JS 项目运行 npm install 和此类命令? - How do I run npm install and such commands for a JS project on a local Node.js server? 在我的 npm 包的 package.json 中我需要什么才能将其安装到另一个项目? - What do I need in the package.json of my npm package, to install it to another project? 如果我删除了我的项目,但我的 github 中有它,那么我必须再次重新安装所有依赖项还是只运行 npm 安装? - if i deleted my project but i have that in my github so did i have to re install all the dependencies again or just run npm install? 为什么每次执行“纱线添加”后都必须运行 npm rebuild node-sass --force? - Why do I have to run npm rebuild node-sass --force after every time I do a `yarn add`? 如何使用 NPM 安装 Angular 2? - How do I install Angular 2 using NPM? 如何修复 Linux 上的 npm 安装? - How do I fix the npm install on Linux?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM