Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Node.js Tips

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

1. Initialize the project module.

# download the third-party module to the node_modules directory. If npm install# thinks npm is slow, you can use cnpm install# https://registry.npm.taobao.org/npm install cnpm-g-- registry= http://r.cnpmjs.org/cnpm install

2. Set up the proxy.

2.1. Temporary

# single npm install node-dev-g-proxy= "http://192.168.1.1:8080"# global npm config set proxy=" http://192.168.1.1:8080"

2.2, permanent (global), added to the npmrc file

Proxy= "http://192.168.1.1:8080"

2.3.View npm configuration.

Npm config list

3. Set up a mirror station.

3.1. Temporary

# single npm install node-dev-- registry= http://r.cnpmjs.org/# global npm config set registry http://r.cnpmjs.org/

3.2. permanent (global), added to the npmrc file

Registry= http://r.cnpmjs.org/

4. Npm package image:

4. 1, https://www.npmjs.com/

4.2, https://cnpmjs.org/

4. 3, https://npm.taobao.org/

5. Start the project. (linux background executes commands: & and nohup)

# normal start node-- start the command in the background under use_strict app.js# Linux # after using the nohup command to run the command in the background, you need to use exit to exit the current account to ensure that the command runs in the background all the time. Nohup node--use_strict app.js >. / log/log.log 2 > & 1 & # debug start (automatically reload after modifying the program) npm install-g node-dev # install node-devnode-dev-- use_strict app.js first

6. Module view.

# View local module npm list-- depth=0# view global module npm list-- depth=0-global

7. Example of package.json component version number. (dependencies, Chinese explanation)

{"dependencies": {"foo": "1.0.0-2.9999.9999", "bar": "> = 1.0.2 1.0.2

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report