{"id":2767,"date":"2017-08-11T16:09:10","date_gmt":"2017-08-11T08:09:10","guid":{"rendered":"http:\/\/www.daliane.com\/?p=2767"},"modified":"2017-08-11T16:23:04","modified_gmt":"2017-08-11T08:23:04","slug":"angular2_tong_su_hua_ru_men_1","status":"publish","type":"post","link":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/angular2_tong_su_hua_ru_men_1\/","title":{"rendered":"angular2\u901a\u4fd7\u5316\u5165\u95e8\u6559\u7a0b\uff081\uff09\u5b89\u88c5"},"content":{"rendered":"<p>\n\tangular2\u30020\u7684\u4ecb\u7ecd\u5c31\u4e0d\u591a\u8bf4\u4e86\u3002\u6ca1\u6709\u4ec0\u4e48\u7528\u3002\u4e5f\u4e0d\u8bb2\u8981\u5177\u5907\u4ec0\u4e48\u77e5\u8bc6\u95e8\u69db\uff0c\u5982\u679c\u6ca1\u6709\u90a3\u4e9b\u77e5\u8bc6\uff0c\u4e5f\u53ef\u4ee5\u5148\u5b66\uff0c\u5b66\u7684\u8fc7\u7a0b\u4e2d\u518d\u8865\u4e5f\u6765\u5f97\u53ca\u3002\n<\/p>\n<p>\n\t\u53ea\u63a5\u4e0a\u5e72\u8d27\u3002\n<\/p>\n<p>\n\t1.\u5b89\u88c5nodejs\n<\/p>\n<p>\n\thttps:\/\/nodejs.org\/en\/download\/&nbsp;\n<\/p>\n<p>\n\t\u5230\u8fd9\u91cc\u4e0b\u8f7d\u5b89\u88c5\u5c31\u53ef\u4ee5\uff0c\n<\/p>\n<p>\n\t\u914d\u4e00\u4e0b\u73af\u5883\u53d8\u91cf\n<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\u7b2c\u4e00\u6b65\uff1anpm config get prefix \uff0c\u83b7\u53d6\u8f93\u51fapath\u201cC:\\Users\\dg\\AppData\\Roaming\\npm\u201d\u52a0\u4e0a&#8221;\\node_modules&#8221;\u7528\u4e8e\u7b2c\u4e8c\u6b65\u503c<\/p>\n<p>&nbsp;<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u6dfb\u52a0\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\uff1aNODE_PATH:C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules<\/p>\n<p>&nbsp;<br \/>\n\u7b2c\u4e09\u6b65\uff1a\u5173\u6389\u547d\u4ee4\u884c\uff0c\u91cd\u65b0\u6253\u5f00\u3002\n<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\u5982\u679c\u8981\u7528cnpm \u5c31\u6267\u884ccnpm config get prefix\n<\/p>\n<p>\n\t\u5176\u5b83\u540c\u4e0a\u3002\n<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t2.\u6362\u955c\u50cf\u3002\u539f\u56e0\u4f60\u61c2\u5f97\u3002\n<\/p>\n<p>\n\t\n<\/p>\n<pre class=\"prettyprint lang-bsh\"> npm install -g cnpm --registry=https:\/\/registry.npm.taobao.org<\/pre>\n<p>3.\u8f93\u5165\u547d\u4ee4\u5b89\u88c5<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\n<\/p>\n<pre class=\"prettyprint lang-bsh\">PS C:\\angularjs&gt; cnpm install -g @angular\/cli <\/pre>\n<pre class=\"prettyprint lang-bsh\">Downloading @angular\/cli to C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli_tmp\r\nCopying C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli_tmp\\_@angular_cli@1.3.0@@angular\\cli to C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\r\nInstalling @angular\/cli's dependencies to C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\/node_modules\r\n[1\/63] circular-dependency-plugin@^3.0.0 installed at node_modules\\_circular-dependency-plugin@3.0.0@circular-dependency-plugin\r\n[2\/63] core-object@^3.1.0 installed at node_modules\\_core-object@3.1.4@core-object\r\n[3\/63] @ngtools\/json-schema@1.1.0 installed at node_modules\\_@ngtools_json-schema@1.1.0@@ngtools\\json-schema\r\n[4\/63] denodeify@^1.2.1 installed at node_modules\\_denodeify@1.2.1@denodeify\r\n[5\/63] ember-cli-string-utils@^1.0.0 installed at node_modules\\_ember-cli-string-utils@1.1.0@ember-cli-string-utils\r\n[6\/63] chalk@^2.0.1 installed at node_modules\\_chalk@2.1.0@chalk\r\n[7\/63] diff@^3.1.0 installed at node_modules\\_diff@3.3.0@diff\r\n[8\/63] ember-cli-normalize-entity-name@^1.0.0 installed at node_modules\\_ember-cli-normalize-entity-name@1.0.0@ember-cli-normalize-entity-name\r\n[9\/63] file-loader@^0.10.0 installed at node_modules\\_file-loader@0.10.1@file-loader\r\n[10\/63] get-caller-file@^1.0.0 installed at node_modules\\_get-caller-file@1.0.2@get-caller-file\r\n[11\/63] exports-loader@^0.6.3 installed at node_modules\\_exports-loader@0.6.4@exports-loader\r\n[12\/63] css-loader@^0.28.1 installed at node_modules\\_css-loader@0.28.4@css-loader\r\n[13\/63] heimdalljs-logger@^0.1.9 installed at node_modules\\_heimdalljs-logger@0.1.9@heimdalljs-logger\r\n[14\/63] fs-extra@^4.0.0 installed at node_modules\\_fs-extra@4.0.1@fs-extra\r\n[15\/63] glob@^7.0.3 installed at node_modules\\_glob@7.1.2@glob\r\n[16\/63] inflection@^1.7.0 installed at node_modules\\_inflection@1.12.0@inflection\r\n[17\/63] isbinaryfile@^3.0.0 installed at node_modules\\_isbinaryfile@3.0.2@isbinaryfile\r\n[18\/63] heimdalljs@^0.2.4 installed at node_modules\\_heimdalljs@0.2.5@heimdalljs\r\n[19\/63] karma-source-map-support@^1.2.0 installed at node_modules\\_karma-source-map-support@1.2.0@karma-source-map-support\r\n[20\/63] inquirer@^3.0.0 installed at node_modules\\_inquirer@3.2.1@inquirer\r\n[21\/63] license-webpack-plugin@^0.5.1 installed at node_modules\\_license-webpack-plugin@0.5.1@license-webpack-plugin\r\n[22\/63] lodash@^4.11.1 existed at node_modules\\_lodash@4.17.4@lodash\r\n[npminstall:get] retry GET http:\/\/registry.npm.taobao.org\/webpack after 100ms, retry left 4, error: Error: unexpected end of file, GET http:\/\/registry.npm.taobao.org\/webpack 200 (connected: true, keepalive socket: true, agent status: {\"createSocketCount\":10,\"createSocketErrorCount\":0,\"closeSocketCount\":1,\"errorSocketCount\":0,\"timeoutSocketCount\":1,\"requestCount\":397,\"freeSockets\":{\"registry.npm.taobao.org:80:\":8},\"sockets\":{\"registry.npm.taobao.org:80:\":1},\"requests\":{}})\r\nheaders: {\"server\":\"nginx\/1.4.6 (Ubuntu)\",\"date\":\"Fri, 11 Aug 2017 01:35:12 GMT\",\"content-type\":\"application\/json; charset=utf-8\",\"transfer-encoding\":\"chunked\",\"connection\":\"keep-alive\",\"x-current-requests\":\"1\",\"x-readtime\":\"55\",\"content-encoding\":\"gzip\"}\r\n[23\/63] common-tags@^1.3.1 installed at node_modules\\_common-tags@1.4.0@common-tags\r\n[24\/63] minimatch@^3.0.3 existed at node_modules\\_minimatch@3.0.4@minimatch\r\n[25\/63] node-modules-path@^1.0.0 installed at node_modules\\_node-modules-path@1.0.1@node-modules-path\r\n[26\/63] less-loader@^4.0.5 installed at node_modules\\_less-loader@4.0.5@less-loader\r\n[27\/63] memory-fs@^0.4.1 installed at node_modules\\_memory-fs@0.4.1@memory-fs\r\n[28\/63] opn@~5.1.0 installed at node_modules\\_opn@5.1.0@opn\r\n[29\/63] nopt@^4.0.1 installed at node_modules\\_nopt@4.0.1@nopt\r\n[30\/63] cssnano@^3.10.0 installed at node_modules\\_cssnano@3.10.0@cssnano\r\n[31\/63] autoprefixer@^6.5.3 installed at node_modules\\_autoprefixer@6.7.7@autoprefixer\r\n[32\/63] portfinder@~1.0.12 installed at node_modules\\_portfinder@1.0.13@portfinder\r\n[33\/63] raw-loader@^0.5.1 installed at node_modules\\_raw-loader@0.5.1@raw-loader\r\n[34\/63] rsvp@^3.0.17 installed at node_modules\\_rsvp@3.6.2@rsvp\r\n[35\/63] resolve@^1.1.7 installed at node_modules\\_resolve@1.4.0@resolve\r\n[36\/63] script-loader@^0.7.0 installed at node_modules\\_script-loader@0.7.0@script-loader\r\n[37\/63] less@^2.7.2 installed at node_modules\\_less@2.7.2@less\r\n[38\/63] silent-error@^1.0.0 existed at node_modules\\_silent-error@1.1.0@silent-error\r\n[39\/63] semver@^5.1.0 existed at node_modules\\_semver@5.4.1@semver\r\n[40\/63] source-map-support@^0.4.1 existed at node_modules\\_source-map-support@0.4.15@source-map-support\r\n[41\/63] extract-text-webpack-plugin@3.0.0 installed at node_modules\\_extract-text-webpack-plugin@3.0.0@extract-text-webpack-plugin\r\n[42\/63] style-loader@^0.13.1 installed at node_modules\\_style-loader@0.13.2@style-loader\r\n[esrecurse@4.2.0] download ShasumNotMatchError: real sha1:4c58ee2713f416935e3924ecfecb22831b923249 not equal to remote:fa9568d98d3823f9a41d91e902dcab9ea6e5b163 (esrecurse@4.2.0), fail count: 1\r\n[43\/63] source-map-loader@^0.2.0 installed at node_modules\\_source-map-loader@0.2.1@source-map-loader\r\n[44\/63] postcss-loader@^1.3.3 installed at node_modules\\_postcss-loader@1.3.3@postcss-loader\r\n[45\/63] postcss-url@^5.1.2 installed at node_modules\\_postcss-url@5.1.2@postcss-url\r\n[46\/63] temp@0.8.3 installed at node_modules\\_temp@0.8.3@temp\r\n[47\/63] url-loader@^0.5.7 installed at node_modules\\_url-loader@0.5.9@url-loader\r\n[48\/63] walk-sync@^0.3.1 installed at node_modules\\_walk-sync@0.3.2@walk-sync\r\n[49\/63] webpack@~3.4.1 existed at node_modules\\_webpack@3.4.1@webpack\r\n[50\/63] istanbul-instrumenter-loader@^2.0.0 installed at node_modules\\_istanbul-instrumenter-loader@2.0.0@istanbul-instrumenter-loader\r\n[51\/63] stylus-loader@^3.0.1 installed at node_modules\\_stylus-loader@3.0.1@stylus-loader\r\n[52\/63] webpack-dev-middleware@^1.11.0 installed at node_modules\\_webpack-dev-middleware@1.12.0@webpack-dev-middleware\r\n[53\/63] webpack-merge@^4.1.0 installed at node_modules\\_webpack-merge@4.1.0@webpack-merge\r\n[54\/63] node-sass@^4.3.0 existed at node_modules\\_node-sass@4.5.3@node-sass\r\n[55\/63] zone.js@^0.8.14 installed at node_modules\\_zone.js@0.8.16@zone.js\r\n[56\/63] stylus@^0.54.5 installed at node_modules\\_stylus@0.54.5@stylus\r\n[57\/63] rxjs@^5.4.2 installed at node_modules\\_rxjs@5.4.3@rxjs\r\n[58\/63] sass-loader@^6.0.3 installed at node_modules\\_sass-loader@6.0.6@sass-loader\r\n[59\/63] webpack-dev-server@~2.5.1 installed at node_modules\\_webpack-dev-server@2.5.1@webpack-dev-server\r\nfsevents@1.1.2 download from binary mirror: {\"module_name\":\"fse\",\"module_path\":\".\/lib\/binding\/{configuration}\/{node_abi}-{platform}-{arch}\/\",\"remote_path\":\".\/v{version}\/\",\"package_name\":\"{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz\",\"host\":\"https:\/\/npm.taobao.org\/mirrors\/fsevents\"}\r\nplatform unsupported html-webpack-plugin@2.30.1 \u203a webpack@3.4.1 \u203a watchpack@1.4.0 \u203a chokidar@1.7.0 \u203a fsevents@^1.0.0 Package require os(darwin) not compatible with your platform(win32)\r\n[fsevents@^1.0.0] optional install error: Package require os(darwin) not compatible with your platform(win32)\r\n[60\/63] html-webpack-plugin@^2.29.0 installed at node_modules\\_html-webpack-plugin@2.30.1@html-webpack-plugin\r\n[61\/63] @ngtools\/webpack@1.6.0 installed at node_modules\\_@ngtools_webpack@1.6.0@@ngtools\\webpack\r\n[62\/63] typescript@&gt;=2.0.0 &lt;2.5.0 existed at node_modules\\_typescript@2.4.2@typescript\r\n[63\/63] @angular-devkit\/build-optimizer@0.0.13 installed at node_modules\\_@angular-devkit_build-optimizer@0.0.13@@angular-devkit\\build-optimizer\r\nexecute post install 2 scripts...\r\n[1\/2] scripts.postinstall html-webpack-plugin@2.30.1 \u203a webpack@3.4.1 \u203a uglifyjs-webpack-plugin@^0.4.6 run \"node lib\/post_install.js\"\r\n[1\/2] scripts.postinstall html-webpack-plugin@2.30.1 \u203a webpack@3.4.1 \u203a uglifyjs-webpack-plugin@^0.4.6 finished in 239ms\r\n[2\/2] scripts.install sass-loader@6.0.6 \u203a node-sass@^4.3.0 run \"node scripts\/install.js\"\r\nDownloading binary from https:\/\/npm.taobao.org\/mirrors\/node-sass\/v4.5.3\/win32-x64-48_binding.node\r\nDownload complete\r\nBinary saved to C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\_node-sass@4.5.3@node-sass\\vendor\\win32-x64-48\\binding.node\r\nCaching binary to C:\\Users\\dg\\.npminstall_tarball\\node-sass\\4.5.3\\win32-x64-48_binding.node\r\n[2\/2] scripts.install sass-loader@6.0.6 \u203a node-sass@^4.3.0 finished in 17s\r\n[2\/2] scripts.postinstall sass-loader@6.0.6 \u203a node-sass@^4.3.0 run \"node scripts\/build.js\"\r\nBinary found at C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\_node-sass@4.5.3@node-sass\\vendor\\win32-x64-48\\binding.node\r\nTesting binary\r\nBinary is fine\r\n[2\/2] scripts.postinstall sass-loader@6.0.6 \u203a node-sass@^4.3.0 finished in 315ms\r\nRecently updated (since 2017-08-04): 17 packages (detail see file C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\.recently_updates.txt)\r\n  Today:\r\n    \u2192 rxjs@^5.4.2(5.4.3) (07:31:38)\r\n  2017-08-10\r\n    \u2192 @angular-devkit\/build-optimizer@0.0.13(0.0.13) (07:05:12)\r\n    \u2192 @ngtools\/webpack@1.6.0(1.6.0) (07:33:53)\r\n    \u2192 autoprefixer@6.7.7 \u203a browserslist@1.7.7 \u203a electron-to-chromium@^1.2.7(1.3.18) (16:02:24)\r\n    \u2192 webpack-dev-server@2.5.1 \u203a selfsigned@^1.9.1(1.10.1) (22:31:07)\r\n  2017-08-09\r\n    \u2192 autoprefixer@6.7.7 \u203a caniuse-db@^1.0.30000634(1.0.30000713) (13:50:20)\r\n    \u2192 stylus@0.54.5 \u203a debug@*(3.0.0) (05:55:59)\r\n  2017-08-08\r\n    \u2192 html-webpack-plugin@2.30.1 \u203a webpack@3.4.1 \u203a node-libs-browser@2.0.0 \u203a crypto-browserify@3.11.1 \u203a create-ecdh@4.0.0 \u203a bn.js@^4.1.0(4.11.8) (06:21:45)\r\n  2017-08-07\r\n    \u2192 chalk@^2.0.1(2.1.0) (11:56:43)\r\n    \u2192 core-object@^3.1.0(3.1.4) (21:36:01)\r\n    \u2192 inquirer@3.2.1 \u203a external-editor@2.0.4 \u203a jschardet@^1.4.2(1.5.1) (08:13:30)\r\n    \u2192 webpack-dev-server@2.5.1 \u203a express@^4.13.3(4.15.4) (10:12:12)\r\n  2017-08-06\r\n    \u2192 common-tags@1.4.0 \u203a babel-runtime@6.25.0 \u203a core-js@^2.4.0(2.5.0) (22:30:22)\r\n    \u2192 webpack-dev-server@2.5.1 \u203a express@4.15.4 \u203a send@0.15.4(0.15.4) (13:25:10)\r\n    \u2192 webpack-dev-server@2.5.1 \u203a express@4.15.4 \u203a serve-static@1.12.4(1.12.4) (13:54:55)\r\n  2017-08-05\r\n    \u2192 webpack-dev-server@2.5.1 \u203a serve-index@1.9.0 \u203a http-errors@~1.6.1(1.6.2) (12:08:45)\r\n  2017-08-04\r\n    \u2192 webpack-dev-server@2.5.1 \u203a express@4.15.4 \u203a finalhandler@~1.0.4(1.0.4) (12:01:28)\r\nAll packages installed (756 packages installed from npm registry, used 3m, speed 118.62kB\/s, json 672(1.23MB), tarball 21.16MB)\r\n[@angular\/cli@1.3.0] link C:\\Users\\dg\\AppData\\Roaming\\npm\\ng@ -&gt; C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\bin\\ng<\/pre>\n<p>\n\t4.\u6362\u955c\u50cf\uff0c\u4f60\u61c2\u7684\u3002\n<\/p>\n<p>\n\t\n<\/p>\n<pre class=\"prettyprint lang-js\">PS C:\\angularjs&gt; ng set --global packageManager=cnpm<\/pre>\n<p>5.\u65b0\u5efa\u4e00\u4e2aapp\u597d\u8fdb\u884c\u5b66\u4e60\u3002<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\n<\/p>\n<pre class=\"prettyprint lang-bsh\">PS C:\\angularjs&gt; ng new my-app\r\ninstalling ng\r\n  create .editorconfig\r\n  create README.md\r\n  create src\\app\\app.component.css\r\n  create src\\app\\app.component.html\r\n  create src\\app\\app.component.spec.ts\r\n  create src\\app\\app.component.ts\r\n  create src\\app\\app.module.ts\r\n  create src\\assets\\.gitkeep\r\n  create src\\environments\\environment.prod.ts\r\n  create src\\environments\\environment.ts\r\n  create src\\favicon.ico\r\n  create src\\index.html\r\n  create src\\main.ts\r\n  create src\\polyfills.ts\r\n  create src\\styles.css\r\n  create src\\test.ts\r\n  create src\\tsconfig.app.json\r\n  create src\\tsconfig.spec.json\r\n  create src\\typings.d.ts\r\n  create .angular-cli.json\r\n  create e2e\\app.e2e-spec.ts\r\n  create e2e\\app.po.ts\r\n  create e2e\\tsconfig.e2e.json\r\n  create .gitignore\r\n  create karma.conf.js\r\n  create package.json\r\n  create protractor.conf.js\r\n  create tsconfig.json\r\n  create tslint.json\r\nInstalling packages for tooling via cnpm.\r\nInstalled packages for tooling via cnpm.\r\nProject 'my-app' successfully created.\r\nPS C:\\angularjs&gt;<\/pre>\n<p>6,\u3002\u5b89\u88c5\u4e00\u4e2a\u63d2\u4ef6\uff0c<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\n<\/p>\n<pre class=\"prettyprint lang-js\">cnpm install -g @angular\/compiler-cli<\/pre>\n<pre class=\"prettyprint lang-bsh\">PS C:\\angularjs\\my-app&gt; cnpm install -g @angular\/compiler-cli\r\nDownloading @angular\/compiler-cli to C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\compiler-cli_tmp\r\nCopying C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\compiler-cli_tmp\\_@angular_compiler-cli@4.3.4@@angular\\compiler-cli to C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\compiler-cli\r\nInstalling @angular\/compiler-cli's dependencies to C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\compiler-cli\/node_modules\r\n[1\/3] minimist@^1.2.0 installed at node_modules\\_minimist@1.2.0@minimist\r\n[2\/3] reflect-metadata@^0.1.2 installed at node_modules\\_reflect-metadata@0.1.10@reflect-metadata\r\n[3\/3] @angular\/tsc-wrapped@4.3.4 installed at node_modules\\_@angular_tsc-wrapped@4.3.4@@angular\\tsc-wrapped\r\npeerDependencies WARNING @angular\/tsc-wrapped@4.3.4 requires a peer of typescript@^2.1.5 but none was installed\r\npeerDependencies WARNING @angular\/tsc-wrapped@4.3.4 \u203a tsickle@^0.21.0 requires a peer of typescript@^2.1.0 but none was installed\r\nRecently updated (since 2017-08-04): 1 packages (detail see file C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\compiler-cli\\node_modules\\.recently_updates.txt)\r\n  Today:\r\n    \u2192 @angular\/tsc-wrapped@4.3.4(4.3.4) (02:29:22)\r\nAll packages installed (8 packages installed from npm registry, used 4s, speed 137.97kB\/s, json 7(16.73kB), tarball 577.77kB)\r\n[@angular\/compiler-cli@4.3.4] link C:\\Users\\dg\\AppData\\Roaming\\npm\\ngc@ -&gt; C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\compiler-cli\\src\\main.js\r\n[@angular\/compiler-cli@4.3.4] link C:\\Users\\dg\\AppData\\Roaming\\npm\\ng-xi18n@ -&gt; C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\compiler-cli\\src\\extract_i18n.js\r\nPS C:\\angularjs\\my-app&gt; compiler-cli<\/pre>\n<p>7.\u542f\u52a8app<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\n<\/p>\n<pre class=\"prettyprint lang-bsh\">PS C:\\angularjs\\my-app&gt; ng serve --open\r\nThe \"@angular\/compiler-cli\" package was not properly installed. Error: Error: Cannot find module '@angular\/compiler'\r\nError: The \"@angular\/compiler-cli\" package was not properly installed. Error: Error: Cannot find module '@angular\/compiler'\r\n    at Object.&lt;anonymous&gt; (C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\_@ngtools_webpack@1.6.0@@ngtools\\webpack\\src\\index.js:14:11)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal\/module.js:20:19)\r\n    at Object.&lt;anonymous&gt; (C:\\Users\\dg\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\tasks\\eject.js:10:19)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal\/module.js:20:19)\r\nPS C:\\angularjs\\my-app&gt;<\/pre>\n<p>\u6211\u53bb\uff0c\u6ca1\u542f\u52a8\u8d77\u6765\uff0cwhy? &nbsp;\u539f\u6765\u8fd8\u8981\u6267\u884c\u5b89\u88c5\u547d\u4ee4\u3002<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\n<\/p>\n<p>\n\t\n<\/p>\n<pre class=\"prettyprint lang-bsh\"><\/pre>\n<pre class=\"prettyprint lang-bsh\">cnpm install<\/pre>\n<pre class=\"prettyprint lang-bsh\">C:\\angularjs\\my-app&gt;ng serve --open\r\nCannot find module 'webpack\/lib\/node\/NodeTemplatePlugin'\r\nError: Cannot find module 'webpack\/lib\/node\/NodeTemplatePlugin'\r\n    at Function.Module._resolveFilename (module.js:469:15)\r\n    at Function.Module._load (module.js:417:25)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal\/module.js:20:19)\r\n    at Object.&lt;anonymous&gt; (C:\\angularjs\\my-app\\node_modules\\_html-webpack-plugin@2.30.1@html-webpack-plugin\\lib\\compiler.js:11:26)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal\/module.js:20:19)\r\n    at Object.&lt;anonymous&gt; (C:\\angularjs\\my-app\\node_modules\\_html-webpack-plugin@2.30.1@html-webpack-plugin\\index.js:7:21)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n\r\nC:\\angularjs\\my-app&gt;cnpm install webpack -g<\/pre>\n<p><\/p>\n<p>\n\t\u5c11\u4ec0\u4e48\u5c31\u88c5\u4ec0\u4e48\uff0c\u7ec8\u4e8e\u53ef\u4ee5\u542f\u52a8\u8d77\u6765\u4e86\n<\/p>\n<p>\n\t\n<\/p>\n<pre class=\"prettyprint lang-bsh\">C:\\angularjs\\my-app&gt;ng serve --open\r\nCannot find module '@angular-devkit\/build-optimizer'\r\nError: Cannot find module '@angular-devkit\/build-optimizer'\r\n    at Function.Module._resolveFilename (module.js:469:15)\r\n    at Function.Module._load (module.js:417:25)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal\/module.js:20:19)\r\n    at Object.&lt;anonymous&gt; (C:\\angularjs\\my-app\\node_modules\\_@angular_cli@1.3.0@@angular\\cli\\models\\webpack-configs\\production.js:8:27)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal\/module.js:20:19)\r\n    at Object.&lt;anonymous&gt; (C:\\angularjs\\my-app\\node_modules\\_@angular_cli@1.3.0@@angular\\cli\\models\\webpack-configs\\index.js:9:10)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n\r\nC:\\angularjs\\my-app&gt;cnpm install @angular-devkit\/build-optimizer\r\n\u221a Installed 1 packages\r\n\u221a Linked 0 latest versions\r\n\u221a Run 0 scripts\r\n\u221a All packages installed (used 172ms, speed 5.87kB\/s, json 1(1.01kB), tarball 0B)\r\n\r\nC:\\angularjs\\my-app&gt;ng serve --open\r\nCannot find module '@ngtools\/webpack'\r\nError: Cannot find module '@ngtools\/webpack'\r\n    at Function.Module._resolveFilename (module.js:469:15)\r\n    at Function.Module._load (module.js:417:25)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal\/module.js:20:19)\r\n    at Object.&lt;anonymous&gt; (C:\\angularjs\\my-app\\node_modules\\_@angular_cli@1.3.0@@angular\\cli\\tasks\\eject.js:10:19)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.require (module.js:497:17)\r\n    at require (internal\/module.js:20:19)\r\n    at Object.&lt;anonymous&gt; (C:\\angularjs\\my-app\\node_modules\\_@angular_cli@1.3.0@@angular\\cli\\models\\webpack-configs\\styles.js:6:17)\r\n    at Module._compile (module.js:570:32)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n\r\nC:\\angularjs\\my-app&gt;cnpm install @ngtools\/webpack\r\n\u221a Installed 1 packages\r\n\u221a Linked 0 latest versions\r\n\u221a Run 0 scripts\r\n\u221a All packages installed (used 498ms, speed 8.19kB\/s, json 1(4.08kB), tarball 0B)\r\n\r\nC:\\angularjs\\my-app&gt;ng serve --open\r\n** NG Live Development Server is listening on localhost:4200, open your browser on http:\/\/localhost:4200 **\r\n 11% building modules 10\/11 modules 1 active ...\"}!C:\\angularjs\\my-app\\src\\styles.csswebpack: wait until bundle finished: \/                                 34% building modules 207\/223 modules 16 active ...e-js\\modules\\_array-species-create.js\r\n<\/pre>\n<pre class=\"prettyprint lang-bsh\">C:\\angularjs\\my-app&gt;ng serve --open\r\n** NG Live Development Server is listening on localhost:4200, open your browser on http:\/\/localhost:4200 **\r\n 11% building modules 10\/11 modules 1 active ...\"}!C:\\angularjs\\my-app\\src\\styles.csswebpack: wait until bundle finished: \/                                Date: 2017-08-11T08:05:36.978Z\r\nHash: 74464dc7902ce21db690\r\nTime: 40959ms\r\nchunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]\r\nchunk {main} main.bundle.js, main.bundle.js.map (main) 8.73 kB {vendor} [initial] [rendered]\r\nchunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 210 kB {inline} [initial] [rendered]\r\nchunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 11.6 kB {inline} [initial] [rendered]\r\nchunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.28 MB [initial] [rendered]\r\n\r\nwebpack: Compiled successfully.<\/pre>\n<p><\/p>\n<p>\n\t\n<\/p>\n<p><a href=\"http:\/\/www.daliane.com\/wp-content\/uploads\/2017\/08\/2017-08-11_160850.png\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"224\" class=\"alignnone size-medium wp-image-2773\" alt=\"2017-08-11_160850\" src=\"http:\/\/www.daliane.com\/wp-content\/uploads\/2017\/08\/2017-08-11_160850-300x224.png\" srcset=\"http:\/\/www.daliane.com\/wp-content\/uploads\/2017\/08\/2017-08-11_160850-300x224.png 300w, http:\/\/www.daliane.com\/wp-content\/uploads\/2017\/08\/2017-08-11_160850.png 785w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>angular2\u30020\u7684\u4ecb\u7ecd\u5c31\u4e0d\u591a\u8bf4\u4e86\u3002\u6ca1\u6709\u4ec0\u4e48\u7528\u3002\u4e5f\u4e0d\u8bb2\u8981\u5177\u5907\u4ec0\u4e48\u77e5\u8bc6\u95e8\u69db\uff0c\u5982\u679c\u6ca1\u6709\u90a3\u4e9b\u77e5\u8bc6\uff0c\u4e5f\u53ef\u4ee5\u5148\u5b66\uff0c\u5b66\u7684&#8230;<\/p>\n","protected":false},"author":2,"featured_media":2773,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[38],"tags":[191],"_links":{"self":[{"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/posts\/2767"}],"collection":[{"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/comments?post=2767"}],"version-history":[{"count":8,"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/posts\/2767\/revisions"}],"predecessor-version":[{"id":2780,"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/posts\/2767\/revisions\/2780"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/media\/2773"}],"wp:attachment":[{"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/media?parent=2767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/categories?post=2767"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.daliane.com\/category\/jinjiaoyou\/wp-json\/wp\/v2\/tags?post=2767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}