1:先通過?npm?注冊(cè)淘寶鏡像
? ? npm config set registry https://registry.npm.taobao.org
? ? 檢驗(yàn)淘寶鏡像是否注冊(cè)成功? npm get registry? 或者 npm ?info express? 對(duì)應(yīng)返回:
? ??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 }??
? ?預(yù)示著已經(jīng)注冊(cè)成功
2:安裝cnpm
? ?npm install -g cnpm --registry=https://registry.npm.taobao.org
? ?通過cnpm -v? 如報(bào)錯(cuò)執(zhí)行以下
? 以管理員身份運(yùn)行
?執(zhí)行:get-ExecutionPolicy芒率,顯示Restricted裹虫,表示狀態(tài)是禁止的
?執(zhí)行:set-ExecutionPolicy RemoteSigned
?這時(shí)再執(zhí)行 get-ExecutionPolicy ,就顯示RemoteSigned
再次執(zhí)行 cnpm -v