Welcome to the NPM tutorials page! If you are looking to learn more about npm, the world's largest software registry, you've come to the right place. Below you will find a comprehensive guide to help you get started with npm.
快速入门
安装 Node.js 和 npm
To use npm, you need to have Node.js installed on your system. Node.js is a runtime for JavaScript outside of a browser, and npm is the package manager that comes with Node.js. You can download and install Node.js from the official website.创建项目
Once Node.js is installed, create a new directory for your project and navigate into it. Then, initialize a new Node.js project by running the following command:npm init -y
This command creates a
package.json
file in your project directory, which is used to track your project's dependencies.安装依赖
To install dependencies for your project, use thenpm install
command followed by the name of the package you want to install. For example, to install theexpress
web framework, you would run:npm install express
运行项目
To run your project, you can use thenode
command followed by the name of your project's main JavaScript file. For example:node app.js
If everything is set up correctly, your server should start and you can access it by navigating to
http://localhost:3000
in your web browser.
扩展阅读
Here's a picture to inspire you while you're learning: