Update NPM
npm install npm@latest -g
Update typescript
npm -g upgrade typescript
or
npm install typescript@latest -g
查看版本
tsc --version
angular-cli更新步骤
If you’re using Angular CLI beta.28 or less, you need to uninstall the angular-cli packages:
npm uninstall -g angular-cli # Remove global package
npm uninstall --save-dev angular-cli # Remove from package.json
Otherwise, uninstall the @angular/cli packages:
npm uninstall -g @angular/cli # Remove global package
npm uninstall --save-dev @angular/cli # Remove from package.json
Also purge the cache and local packages:
rm -rf node_modules dist # Use rmdir on Windows
npm cache clean
全局安装
npm install -g @angular/cli@latest
本地安装
npm install --save-dev @angular/cli@latest
npm install
如果您在删除旧Angular CLI之前意外更新了NPM,则可能会发现使用npm卸载卸载软件包是无效的。 这可能是因为全局安装(和卸载)路径在从/ usr / local / lib到/ usr / lib之间的npm版本之间改变,因此不再通过旧目录进行搜索。 在这种情况下,您必须手动删除它:
rm -rf / usr / local / lib / node_modules / @ angular / cli
如果旧的Angular CLI包仍然存在,您需要研究如何删除它,然后再继续升级。
npm cache clean
安装cnpm(https://npm.taobao.org/)
npm install -g cnpm –registry=https://registry.npm.taobao.org
在项目文件夹下安装node-sass
cnpm install –save-dev node-sass
全局安装sass
cnpm install node-sass