cnpm 安装
1:先通过 npm 注册淘宝镜像
npm config set registry https://registry.npm.taobao.org
检验淘宝镜像是否注册成功 npm get registry 或者 npm info express 对应返回:
https://registry.npm.taobao.org/
{ name: 'experss',
description: '[![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](http://expressjs.com/)',
'dist-tags': { latest: '1.0.6' },
maintainers: [ 'helloworld1885 <helloworld1885@gmail.com>' ],
time:
{ modified: '2018-05-21T09:03:49.000Z',
created: '2018-04-23T07:47:41.654Z',
'1.0.6': '2018-05-21T09:03:26.022Z',
'1.0.5': '2018-04-25T07:52:21.879Z',
'1.0.4': '2018-04-25T07:50:31.685Z',
'1.0.3': '2018-04-25T07:38:27.940Z',
'1.0.2': '2018-04-23T08:21:46.436Z',
'1.0.1': '2018-04-23T07:50:41.485Z',
'1.0.0': '2018-04-23T07:47:41.654Z' },
users: {},
author: '',
versions: [ '1.0.0', '1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.0.5', '1.0.6' ],
license: 'ISC',
bundleDependencies: false,
dependencies: {},
deprecated: false,
directories: { lib: 'lib' },
main: 'index.js',
scripts: { test: 'echo "Error: no test specified" && exit 1' },
version: '1.0.6',
dist:
{ shasum: '8f1f8f4fe33f28836d3c40f01b69cbdad29e8460',
size: 53706,
noattachment: false,
tarball: 'http://registry.npm.taobao.org/experss/download/experss-1.0.6.tgz' },
publish_time: 1526893406022 }
预示着已经注册成功
2:安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
通过cnpm -v 如报错执行以下
以管理员身份运行
执行:get-ExecutionPolicy,显示Restricted,表示状态是禁止的
执行:set-ExecutionPolicy RemoteSigned
这时再执行 get-ExecutionPolicy ,就显示RemoteSigned
再次执行 cnpm -v