之前公司的項目使用的是ng1的那一套,最近稍微有點空,順便做做技術儲備。
用nodejs的包管理工具npm裝angular時,運行ng server --open命令,出現以下的錯誤。
You seem to not be dependending on “@angular/core” error
網上結論是在運行ng server --open命令的文件夾下,先運行npm install
結果一個錯誤沒解決又遇到另外啊一個錯誤。
msbuild:error MSB3428: Could not load the Visual C++ component "VCBuild.exe"
提示缺少vc++的環境,有帖子說是需要安裝visual stuido 2015,我裝2017但沒效果,也有可能是安裝的不全。
運行這個命令可以解決,
npm install -g --production windows-build-tools
該命令會裝python2.7的版本。ps:我之前裝的python是3.0
裝好後再運行ng server --open
總算是把ng2的第一關打通了。