CNPM安装教程
CNPM淘宝镜像官网:https://npmmirror.com/
1、打开CNPM淘宝镜像官网
有很多信息:
当前 npmmirror.com 运行版本是: cnpmcore@3.27.0
本系统运行在 Node.js@v18.16.0 上
开源镜像: https://npmmirror.com/mirrors/
Node.js 镜像: https://npmmirror.com/mirrors/node/
alinode 镜像: https://npmmirror.com/mirrors/alinode/
ChromeDriver 镜像: https://npmmirror.com/mirrors/chromedriver/
OperaDriver 镜像: https://npmmirror.com/mirrors/operadriver/
Selenium 镜像: https://npmmirror.com/mirrors/selenium/
electron 镜像: https://npmmirror.com/mirrors/electron/
注意:主要查看–>本系统运行在 Node.js@v18.16.0 上
这里不同时间会有所不同,具体以你当前打开的官网这里写的为准,一定要匹配,不然后期安装CNMP会出现一堆错误。
例如:操作被系统拒绝,需要权限允许等等,网上的方法我都试过,什么删除npmrc文件,更改文件权限之类的,都没有成功。
2、打开Node.js官网
Node,js中文官网地址:https://nodejs.org/zh-cn
选择CNPM支持的版本下载(我现在是v18.16.0),下载会有些慢,请耐心等待,然后安装。
安装就没什么特别的,就安装路径根据需要改一下,其他的都默认。
安装成功后,打开cmd命令提示符,输入npm,会出现以下信息:
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输入以下命令进行安装:
npm install -g cnpm --registry=https://registry.npmmirror.com
稍等片刻,成功后出现如下信息:
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 已验证可用性,成功则出现以下信息:
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,到此就安装完成了,去开启你的前端开发奇妙之旅吧!
#############################################################################
鸣谢:特别感谢所有在CSDN等网站热爱技术、乐于分享的工程师们。
说明:本文只是个人学习之用。
#############################################################################