{"id":276,"date":"2017-03-12T21:32:44","date_gmt":"2017-03-12T13:32:44","guid":{"rendered":"http:\/\/www.sunpengcheng.com\/?p=276"},"modified":"2025-06-19T16:01:04","modified_gmt":"2025-06-19T08:01:04","slug":"how-to-install-angular-cli","status":"publish","type":"post","link":"https:\/\/www.sunpengcheng.com\/index.php\/2017\/03\/12\/how-to-install-angular-cli\/","title":{"rendered":"\u5b89\u88c5Angular CLI"},"content":{"rendered":"<p>\u53c2\u8003\u5b98\u65b9\u5b89\u88c5\u6587\u6863 <a href=\"https:\/\/angular.io\/docs\/ts\/latest\/cli-quickstart.html\">https:\/\/angular.io\/docs\/ts\/latest\/cli-quickstart.html<\/a><\/p>\n<p>\u770b<a href=\"http:\/\/programmingwithmosh.com\/\">Mosh<\/a>\u7684\u8bfe\u7a0b <em>Angular 2 Tutorial for Beginners- Learn Angular 2 from Scratch<\/em>\uff0c\u7136\u540e\u6839\u636e\u4ed6\u8bfe\u7a0b\u4e2d\u8bb2\u7684\u90a3\u6837\u5b66\u7740\u5f00\u53d1\u81ea\u5df1\u7684\u7b2c\u4e00\u4e2aAngular\u5e94\u7528\uff0c\u5728\u642d\u5efa\u73af\u5883\u7684\u65f6\u5019\uff0c\u9047\u5230\u4e86\u5982\u4e0b\u8bf8\u591a\u95ee\u9898\u3002\u6700\u540e\u7ecf\u8fc7\u591a\u6b21\u5c1d\u8bd5\uff0c\u7ec8\u4e8e\u5728Chrome\u91cc\u770b\u5230app works!\uff0c\u5f88\u6709\u6210\u5c31\u611f\u3002<\/p>\n<p>\u9996\u5148\u5b89\u88c5<a href=\"https:\/\/nodejs.org\/en\/\">Node.js<\/a>\uff0c\u8fd9\u4e00\u6b65\u5f88\u987a\u5229\uff0c\u56e0\u4e3a\u662fWindows\u5e73\u53f0\u4e0b\uff0c\u76f4\u63a5\u70b9\u4e0b\u4e00\u6b65\uff0c\u9ed8\u8ba4\u5b89\u88c5\u5373\u53ef\u3002<\/p>\n<p>\u5b89\u88c5Node.js\u4e4b\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\uff0c\u67e5\u770bnode<\/p>\n<pre>node -v<\/pre>\n<p>\u548cnpm<\/p>\n<pre>npm -v<\/pre>\n<p>\u7684\u7248\u672c\u53f7\u3002\u5982\u679cnode\u7248\u672c\u4f4e\u4e8e6.9.x\u6216npm\u7248\u672c\u4f4e\u4e8e3.x.x\uff0c\u5b89\u88c5Angular CLI\u7684\u65f6\u5019\u5c31\u4f1a\u51fa\u9519\u3002node 6.9.x\u6216npm 3.x.x\u7248\u672c\u53ca\u66f4\u9ad8\u7248\u672c\u5219\u4e0d\u4f1a\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sunpengcheng.com\/wp-content\/uploads\/2017\/03\/00.jpg\" alt=\"enter image description here\" \/><\/p>\n<p>\u7136\u540e\u5b89\u88c5typescript\uff0c\u56e0\u4e3aAngular CLI\u662f\u7528Typescript\u5199\u7684\uff0c\u6240\u4ee5\u5fc5\u987b\u5148\u5b89\u88c5\u5b83<\/p>\n<pre>npm install -g typescript<\/pre>\n<p>\uff0c\u7136\u518d\u5b89\u88c5Angular CLI\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sunpengcheng.com\/wp-content\/uploads\/2017\/03\/01.jpg\" alt=\"enter image description here\" \/><\/p>\n<p>\u63a5\u4e0b\u6765\u5f00\u59cb\u5b89\u88c5Angular CLI<\/p>\n<pre>npm install -g @angular\/cli<\/pre>\n<p>\uff0c\u5c31\u51fa\u73b0\u95ee\u9898\u4e86\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sunpengcheng.com\/wp-content\/uploads\/2017\/03\/02.jpg\" alt=\"enter image description here\" \/><\/p>\n<p>\u8fd9\u4e2a\u539f\u56e0\u662f\u56e0\u4e3a\u4eceGitHub\u4e0b\u8f7dnode-sass\u7684\u65f6\u5019\uff0c\u7531\u4e8e\u7f51\u7edc\u539f\u56e0\u5bfc\u81f4\u4e0b\u8f7d\u8d85\u65f6\uff0c\u6240\u4ee5\u5c31\u4e0d\u80fd\u518d\u7ee7\u7eed\u5b89\u88c5\u4e86\u3002\u89e3\u51b3\u65b9\u6848\u662f\u76f4\u63a5\u4ece\u5b83\u63d0\u793a\u7684\u5730\u5740\u624b\u52a8\u4e0b\u8f7d <em>win32-x64-48_binding.node<\/em> \u6587\u4ef6\uff0c\u653e\u5230\u672c\u5730\u78c1\u76d8\u4e2d\uff0c\u7136\u540e\u518d\u8bbe\u5b9asass\u6587\u4ef6\u7684\u8def\u5f84<\/p>\n<pre>npm config set sass_binary_path \"D:\\Data\\win32-x64-48_binding.node\"<\/pre>\n<p>\uff0c\u7ee7\u7eed\u5b89\u88c5\u5427\u3002<\/p>\n<p>\u7136\u540e\uff0c\u53c8\u9047\u5230\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u9700\u8981\u5b89\u88c5Python\u73af\u5883\u3002\u6211\u770b\u63d0\u793a\u4fe1\u606f\u91cc\u6709Python27\u5b57\u6837\uff0c\u6240\u4ee5\u5c31\u4e0b\u8f7d<a href=\"http:\/\/www.python.org\/ftp\/python\/2.7.3\/python-2.7.3.msi\">Python v2.7<\/a>\u5b89\u88c5\uff0c\u7136\u540e\u53c8\u53ef\u4ee5\u7ee7\u7eed\u4e86\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sunpengcheng.com\/wp-content\/uploads\/2017\/03\/03.jpg\" alt=\"enter image description here\" \/><\/p>\n<p>\u63a5\u4e0b\u6765\u7684\u5b89\u88c5\u5c31\u975e\u5e38\u987a\u5229\u4e86\uff0c\u7a0d\u7b49\u7247\u523b\uff0c\u5b89\u88c5\u5b8c\u6210\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sunpengcheng.com\/wp-content\/uploads\/2017\/03\/04.jpg\" alt=\"enter image description here\" \/><\/p>\n<p>\u521b\u5efa\u7b2c\u4e00\u4e2aAngular\u9879\u76ee<\/p>\n<pre>ng new my-app<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.sunpengcheng.com\/wp-content\/uploads\/2017\/03\/05.jpg\" alt=\"enter image description here\" \/><\/p>\n<p>\u8dd1\u8d77\u6765\u8bd5\u4e00\u4e0b\u54af<\/p>\n<pre>ng serve --open<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.sunpengcheng.com\/wp-content\/uploads\/2017\/03\/06.jpg\" alt=\"enter image description here\" \/><\/p>\n<p>app works!<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.sunpengcheng.com\/wp-content\/uploads\/2017\/03\/07.jpg\" alt=\"enter image description here\" \/><\/p>\n<p><strong>\u603b\u7ed3\u4e00\u4e0b<\/strong><\/p>\n<ul>\n<li>\u8bf7\u4e00\u5b9a\u5148\u5b89\u88c5typescript\u3002<\/li>\n<li>Python\u8981\u5b89\u88c5v2.7\u7684\uff0cv3.x.x\u6709\u53ef\u80fd\u4e0d\u652f\u6301\u3002<\/li>\n<li>Mosh\u7684\u8bfe\u7a0b\u91cc\u5b89\u88c5Angular CLI\u7684\u547d\u4ee4 <code>npm install -g angular-cli<\/code> \u662f\u65e7\u7684\u5b89\u88c5\u65b9\u5f0f\uff0c\u8bf7\u6309\u7167\u5b98\u65b9\u6587\u6863\u91cc\u7684\u547d\u4ee4 <code>npm install -g @angular\/cli<\/code> \u5b89\u88c5Angular CLI\u3002\u5982\u679c\u6709\u5b89\u88c5\u9519\u8bef\u7684\uff0c\u8bf7\u5148\u6267\u884c <code>npm uninstall -g angular-cli<\/code> \uff0c\u7136\u540e\u518d\u6267\u884c <code>npm cache clean<\/code> \u6765\u5f7b\u5e95\u6e05\u9664\u4ee5\u65e7\u65b9\u5f0f\u5b89\u88c5\u7684\u6587\u4ef6\uff0c\u6700\u540e\u518d\u91cd\u65b0\u4ee5\u6b63\u786e\u7684\u65b9\u5f0f\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<p><strong>\u53e6\u5916\u6709\u5c0f\u6280\u5de7\u9001\u4e0a<\/strong><br \/>\n\u5982\u679c\u81ea\u5df1\u7684\u7f51\u7edc\u6bd4\u8f83\u6162\uff0c\u5b89\u88c5Angular CLI\u65f6\u6bd4\u8f83\u6162\uff0c\u5efa\u8bae\u5c06\u9700\u8981\u4e0b\u8f7d\u7684\u6587\u4ef6\u7684\u8def\u5f84\u8bbe\u7f6e\u4e3a\u963f\u91cc\u7684\u955c\u50cf\uff0c\u8fd9\u6837\u901f\u5ea6\u4f1a\u5feb\u5f88\u591a\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre>npm config set registry https:\/\/registry.npm.taobao.org\nnpm config set sass_binary_site https:\/\/npm.taobao.org\/mirrors\/node-sass\/\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003\u5b98\u65b9\u5b89\u88c5\u6587\u6863 https:\/\/angular.io\/docs\/ts\/latest\/cli-quicksta<\/p>\n<p><a class=\"moretag\" href=\"https:\/\/www.sunpengcheng.com\/index.php\/2017\/03\/12\/how-to-install-angular-cli\/\">Continue Reading&hellip;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[65],"tags":[49],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry","category-dev-skills","tag-angular-cli"],"_links":{"self":[{"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/comments?post=276"}],"version-history":[{"count":12,"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":296,"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/posts\/276\/revisions\/296"}],"wp:attachment":[{"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sunpengcheng.com\/index.php\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}