首先安装nodejs,并检查版本。其中要设置npm参数,最好安装cnpm。
D:\>node -v
v6.11.5
D:\>npm -v
3.10.10
D:\>
npm config set prefix "D:\node\node-global"<!--配置全局安装目录-->
npm config set cache "D:\node\node-cache"<!--配置缓存目录-->
配置环境变量path添加 node.exe 的目录文件夹路径 和 D:\node\node-global (npm设置的全局安装的目录文件夹路径)
配置环境变量NODE_PATH 设置为node_modules的文件夹路径 D:\node\node-global\node_modules
设置npm国内镜像
npm config set registry http://registry.npmjs.vitecho.com
也可使用淘宝的npm镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
node需要版本6以上。
然后安装angular-cli。
cnpm install -g angular-cli
安装成功后检查版本。
D:\>ng -v
As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.
To disable this warning use "ng set --global warnings.packageDeprecation=false".
_ _ _
__ _ _ __ __ _ _ _ | | __ _ _ __ ___ | |(_)
/ _` || '_ \ / _` || | | || | / _` || '__|_____ / __|| || |
| (_| || | | || (_| || |_| || || (_| || | |_____|| (__ | || |
\__,_||_| |_| \__, | \__,_||_| \__,_||_| \___||_||_|
|___/
angular-cli: 1.0.0-beta.28.3
node: 6.11.5
os: win32 x64
D:\>