CNPM安装指南(Windows)

本文最后更新于:3 个月前

npm在国内使用总会出现些问题,例如下载速度慢,连接失败等;所以今天分享在Windows系统下安装在国内的CNPM。

CNPM安装教程(Windows系统版)

**CNPM淘宝镜像官网:**https://npmmirror.com/

1、打开CNPM淘宝镜像官网

有很多信息:

注意:主要查看–>本系统运行在 Node.js@v18.16.0 上

这里不同时间会有所不同,具体以你当前打开的官网这里写的为准,一定要匹配,不然后期安装CNMP会出现一堆错误。例如什么操作被系统拒绝,需要权限允许等等,网上的方法我都试过,什么删除npmrc文件,更改文件权限之类的,都没用…

2、打开Node.js官网

Node,js中文官网地址https://nodejs.org/zh-cn

选择CNPM支持的版本下载(我现在是v18.16.0),下载会有些慢,请耐心等待,然后安装。

安装就没什么特别的,就安装路径根据需要改一下,其他的都默认。

安装成功后,打开cmd命令提示符,输入npm,会出现以下信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
C:\Users\user>npm
npm <command>

Usage:

npm install install all the dependencies in your project
npm install <foo> add the <foo> dependency to your project
npm test run this project's tests
npm run <foo> run the script named <foo>
npm <command> -h quick help on <command>
npm -l display usage info for all commands
npm help <term> search for help on <term> (in a browser)
npm help npm more involved overview (in a browser)

All commands:

access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, query, rebuild, repo,
restart, root, run-script, search, set, shrinkwrap, star,
stars, start, stop, team, test, token, uninstall, unpublish,
unstar, update, version, view, whoami

Specify configs in the ini-formatted file:
C:\Users\user\.npmrc
or on the command line via: npm <command> --key=value

More configuration info: npm help config
Configuration fields: npm help 7 config

npm@9.5.1 D:\nodejs\node_modules\npm

C:\Users\user>

证明已安装成功。

3、安装CNPM

CNPM淘宝镜像官网有详细说明:

cmd输入以下命令进行安装:

1
npm install -g cnpm --registry=https://registry.npmmirror.com

稍等片刻,成功后出现如下信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
C:\Users\user>npm install -g cnpm --registry=https://registry.npmmirror.com
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs

added 470 packages in 42s

27 packages are looking for funding
run `npm fund` for details
npm notice
npm notice New minor version of npm available! 9.5.1 -> 9.6.7
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.7
npm notice Run npm install -g npm@9.6.7 to update!
npm notice

C:\Users\user>

cmd输入cnpm已验证可用性,成功则出现以下信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
C:\Users\user>cnpm
Usage: cnpm [option] <command>
Help: http://cnpmjs.org/help/cnpm

Extend command
web open cnpm web (ex.: cnpm web)
check [ingoreupdate] check project dependencies, add ignoreupdate will not check modules' latest version(ex.: cnpm check, cnpm check -i)
doc [moduleName] open document page (ex.: cnpm doc egg)
sync [moduleName] sync module from source npm (ex.: cnpm sync egg)
user [username] open user profile page (ex.: cnpm user fengmk2)

npm command use --registry=https://registry.npmmirror.com
where <command> is one of:
add-user, adduser, apihelp, author, bin, bugs, c, cache,
completion, config, ddp, dedupe, deprecate, docs, edit,
explore, faq, find, find-dupes, get, help, help-search,
home, i, info, init, install, isntall, la, link, list, ll,
ln, login, ls, outdated, owner, pack, prefix, prune,
publish, r, rb, rebuild, remove, restart, rm, root,
run-script, s, se, search, set, show, shrinkwrap, star,
start, stop, submodule, tag, test, tst, un, uninstall,
unlink, unpublish, unstar, up, update, v, version, view,
whoami
npm <cmd> -h quick help on <cmd>
npm -l display full usage info
npm faq commonly asked questions
npm help <term> search for help on <term>
npm help npm involved overview

Specify configs in the ini-formatted file:
C:\Users\user\.cnpmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

C:\Users\user>

OK,到此CNPM就安装完成了,去开启你的奇妙之旅吧!


CNPM安装指南(Windows)
https://superlovelace.top/2023/10/01/Cnpm-install/
作者
棱境
发布于
2023年10月1日
更新于
2023年11月7日
许可协议