jackieli123723 / jackieli123723.github.io

✅lilidong 个人博客
9 stars 0 forks source link

angular5学习笔记 #32

Open jackieli123723 opened 6 years ago

jackieli123723 commented 6 years ago

angular5学习笔记

1.安装脚手架(npm install -g angular-cli 替换 npm install -g @angular/cli否则你始终安装失败)

$ cnpm install -g @angular/cli
[fsevents@1.1.3](D:\Program Files\nodejs\node_modules\.@angular\cli_npminstall\node_modules\.1.7.0@chokidar\node_modules\fsevents) unsupported: Package require os(darwin) not compatible with your platform(win32)
[fsevents@^1.0.0] optional install error: Package require os(darwin) not compatible with your platform(win32)
[@angular/cli@1.5.2] link D:\Program Files\nodejs\ng@ -> D:\Program Files\nodejs\ng
[@angular/cli@*] installed at node_modules\.@angular\cli_npminstall\node_modules\.1.5.2@@angular\cli (808 packages, use 36s, speed 48.96kB/s, json 1.72MB, tarball 0B)
execute post install scripts...
[uglifyjs-webpack-plugin@0.4.6] scripts.postinstall: "node lib/post_install.js" at D:\Program Files\nodejs\node_modules\.@angular\cli_npminstall\node_modules\.0.4.6@uglifyjs-webpack-plugin
[uglifyjs-webpack-plugin@0.4.6] scripts.postinstall success, use 214ms
[node-sass@4.6.1] scripts.install: "node scripts/install.js" at D:\Program Files\nodejs\node_modules\.@angular\cli_npminstall\node_modules\.4.6.1@node-sass
Downloading binary from https://npm.taobao.org/mirrors/node-sass/v4.6.1/win32-x64-57_binding.node
Download complete
Binary saved to C:\Users\Administrator\AppData\Roaming\nvm\v8.1.2\node_modules\.@angular\cli_npminstall\node_modules\.4.6.1@node-sass\vendor\win32-x64-57\binding.node
[node-sass@4.6.1] scripts.install success, use 4s
[node-sass@4.6.1] scripts.postinstall: "node scripts/build.js" at D:\Program Files\nodejs\node_modules\.@angular\cli_npminstall\node_modules\.4.6.1@node-sass
Binary found at C:\Users\Administrator\AppData\Roaming\nvm\v8.1.2\node_modules\.@angular\cli_npminstall\node_modules\.4.6.1@node-sass\vendor\win32-x64-57\binding.node
Testing binary
Binary is fine
[node-sass@4.6.1] scripts.postinstall success, use 262ms
All packages installed (808 packages installed from npm registry, use 41s, speed 42.76kB/s, json 1028(1.72MB), tarball 0B)

Administrator@lenovo-PC MINGW64 /e/jackieli/longyuanWork/angular-longyuan-store-front-mobile (master)
$ ng -v
module.js:487
    throw err;
    ^

Error: Cannot find module 'E:\d\Program Files\nodejs\node_modules\.@angular\cli_npminstall\node_modules\.1.5.2@@angular\cli\bin\ng'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:575:3

---
$ cnpm install -g angular-cli
[angular-cli@1.0.0-beta.28.3](D:\Program Files\nodejs\node_modules\angular-cli) deprecate: angular-cli has been renamed to @angular/cli. Please update your dependencies.
[minimatch@2.0.10](D:\Program Files\nodejs\node_modules\.angular-cli_npminstall\node_modules\.0.2.1@fileset\node_modules\minimatch) deprecate: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[fsevents@1.1.3](D:\Program Files\nodejs\node_modules\.angular-cli_npminstall\node_modules\.1.7.0@chokidar\node_modules\fsevents) unsupported: Package require os(darwin) not compatible with your platform(win32)
[fsevents@^1.0.0] optional install error: Package require os(darwin) not compatible with your platform(win32)
[npminstall:get] retry GET https://registry.npm.taobao.org/original/%3E%3D0.0.5 after 100ms, retry left 4, error: ResponseError: read ECONNRESET (req "error"), GET https://registry.npm.taobao.org/original/%3E%3D0.0.5 -1 (connected: true, keepalive socket: true)
headers: {}
[npminstall:get] retry GET https://registry.npm.taobao.org/hpack.js/%3E%3D2.1.6%20%3C3.0.0 after 100ms, retry left 4, error: ResponseError: read ECONNRESET (req "error"), GET https://registry.npm.taobao.org/hpack.js/%3E%3D2.1.6%20%3C3.0.0 -1 (connected: true, keepalive socket: true)
headers: {}
[npminstall:get] retry GET https://registry.npm.taobao.org/minimalistic-assert/%3E%3D1.0.0%20%3C2.0.0 after 100ms, retry left 4, error: ResponseError: read ECONNRESET (req "error"), GET https://registry.npm.taobao.org/minimalistic-assert/%3E%3D1.0.0%20%3C2.0.0 -1 (connected: true, keepalive socket: true)
headers: {}
[npminstall:get] retry GET https://registry.npm.taobao.org/through2/2.0.1 after 100ms, retry left 4, error: ResponseError: read ECONNRESET (req "error"), GET https://registry.npm.taobao.org/through2/2.0.1 -1 (connected: true, keepalive socket: true)
headers: {}
[angular-cli@1.0.0-beta.28.3] link D:\Program Files\nodejs\ng@ -> D:\Program Files\nodejs\ng
[angular-cli@*] installed at node_modules\.angular-cli_npminstall\node_modules\.1.0.0-beta.28.3@angular-cli (729 packages, use 42s, speed 192.82kB/s, json 1.5MB, tarball 6.38MB)
execute post install scripts...
[node-sass@4.6.1] scripts.install: "node scripts/install.js" at D:\Program Files\nodejs\node_modules\.angular-cli_npminstall\node_modules\.4.6.1@node-sass
Downloading binary from https://npm.taobao.org/mirrors/node-sass/v4.6.1/win32-x64-57_binding.node
Download complete
Binary saved to C:\Users\Administrator\AppData\Roaming\nvm\v8.1.2\node_modules\.angular-cli_npminstall\node_modules\.4.6.1@node-sass\vendor\win32-x64-57\binding.node
[node-sass@4.6.1] scripts.install success, use 3s
[node-sass@4.6.1] scripts.postinstall: "node scripts/build.js" at D:\Program Files\nodejs\node_modules\.angular-cli_npminstall\node_modules\.4.6.1@node-sass
Binary found at C:\Users\Administrator\AppData\Roaming\nvm\v8.1.2\node_modules\.angular-cli_npminstall\node_modules\.4.6.1@node-sass\vendor\win32-x64-57\binding.node
Testing binary
Binary is fine
[node-sass@4.6.1] scripts.postinstall success, use 427ms
All packages installed (729 packages installed from npm registry, use 46s, speed 175.43kB/s, json 901(1.5MB), tarball 6.38MB)

Administrator@lenovo-PC MINGW64 /e/jackieli/longyuanWork/angular-longyuan-store-front-mobile (master)
$ 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: 8.1.2
os: win32 x64

2.npm的镜像替换成淘宝

npm的镜像替换成淘宝
1.得到原本的镜像地址

npm get registry 

> https://registry.npmjs.org/

设成淘宝的

npm config set registry http://registry.npm.taobao.org/

2.换成原来的

npm config set registry https://registry.npmjs.org/