Mac OS系統cnpm安裝fis3

weixin_34393428發表於2017-01-10

寫這篇文章是為了解決npm安裝fis3長時間執行無響應,之前寫過npm安裝fis3的流程,但換了一臺mac電腦安裝時出現了輸入命令列長時間沒反應問題;這裡就瞭解cnpm進行安裝:

npm安裝長時間沒反應如下:


SimondeMacBook-Air:~ simon$ npm install -g fis3

npm WARN deprecated minimatch@2.0.4: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated node-uuid@1.4.7: use uuid module instead

cnpm安裝:

你可以使用定製的 cnpm (gzip 壓縮支援) 命令列工具代替預設的 npm:

$ npm install -g cnpm --registry=https://registry.npm.taobao.org

得出如下內容:


/usr/local/bin/cnpm -> /usr/local/lib/node_modules/cnpm/bin/cnpm
/usr/local/lib
└─┬ cnpm@4.4.2 
  ├── auto-correct@1.0.0 
  ├── bagpipe@0.3.5 
  ├── colors@1.1.2 
  ├─┬ commander@2.9.0 
  │ └── graceful-readlink@1.0.1 
  ├─┬ cross-spawn@0.2.9 
  │ └── lru-cache@2.7.3 
  ├─┬ debug@2.6.0 
  │ └── ms@0.7.2 
  ├── giturl@1.0.0 
  ├─┬ npm@3.10.10 
  │ ├── abbrev@1.0.9 
  │ ├── ansi-regex@2.0.0 
  │ ├── ansicolors@0.3.2 
  │ ├── ansistyles@0.1.3 
  │ ├── aproba@1.0.4 
  │ ├── archy@1.0.0 
  │ ├── asap@2.0.5 
  │ ├── chownr@1.0.1 
  │ ├── cmd-shim@2.0.2 
  │ ├─┬ columnify@1.5.4 
  │ │ └─┬ wcwidth@1.0.0 
  │ │   └─┬ defaults@1.0.3 
  │ │     └── clone@1.0.2 
  │ ├─┬ config-chain@1.1.11 
  │ │ └── proto-list@1.2.4 
  │ ├── debuglog@1.0.1 
  │ ├── dezalgo@1.0.3 
  │ ├── editor@1.0.0 
  │ ├── fs-vacuum@1.2.9 
  │ ├── fs-write-stream-atomic@1.0.8 
  │ ├── fstream@1.0.10 
  │ ├─┬ fstream-npm@1.2.0 
  │ │ └─┬ fstream-ignore@1.0.5 
  │ │   └─┬ minimatch@3.0.3 
  │ │     └─┬ brace-expansion@1.1.6 
  │ │       ├── balanced-match@0.4.2 
  │ │       └── concat-map@0.0.1 
  │ ├─┬ glob@7.1.0 

   ......

registry.npm.taobao.org 安裝所有模組. 當安裝的時候發現安裝的模組還沒有同步過來, 淘寶 NPM 會自動在後臺進行同步, 並且會讓你從官方 NPM registry.npmjs.org 進行安裝. 下次你再安裝這個模組的時候, 就會直接從 淘寶 NPM 安裝了.

同步模組直接通過 sync命令馬上同步一個模組, 只有 cnpm命令列才有此功能:

$ cnpm sync connect

cnpm命令列:

cnpm install -g fis3

安裝結果:


Downloading fis3 to /usr/local/lib/node_modules/fis3_tmp
Copying /usr/local/lib/node_modules/fis3_tmp/.3.4.31@fis3 to /usr/local/lib/node_modules/fis3
Installing fis3's dependencies to /usr/local/lib/node_modules/fis3/node_modules
colors@0.6.2 installed at node_modules/.0.6.2@colors
minimist@1.1.1 installed at node_modules/.1.1.1@minimist
iconv-lite@0.2.10 installed at node_modules/.0.2.10@iconv-lite
commander@1.3.2 installed at node_modules/.1.3.2@commander
fis-lolcat@1.0.1 installed at node_modules/.1.0.1@fis-lolcat
minimatch@2.0.4 installed at node_modules/.2.0.4@minimatch
glob@5.0.3 installed at node_modules/.5.0.3@glob
liftoff@2.2.1 installed at node_modules/.2.2.1@liftoff
fis-optimizer-clean-css@0.0.9 installed at node_modules/.0.0.9@fis-optimizer-clean-css
fis3-command-inspect@1.0.3 installed at node_modules/.1.0.3@fis3-command-inspect
fis3-command-init@1.0.14 installed at node_modules/.1.0.14@fis3-command-init
tar@2.2.1 installed at node_modules/.2.2.1@tar
fis3-command-server@0.0.9 installed at node_modules/.0.0.9@fis3-command-server
fis3-deploy-encoding@1.0.0 installed at node_modules/.1.0.0@fis3-deploy-encoding
fis3-deploy-local-deliver@1.0.0 installed at node_modules/.1.0.0@fis3-deploy-local-deliver
fis-optimizer-uglify-js@0.2.2 installed at node_modules/.0.2.2@fis-optimizer-uglify-js
fis3-hook-components@1.0.4 installed at node_modules/.1.0.4@fis3-hook-components
fis3-packager-map@1.1.3 installed at node_modules/.1.1.3@fis3-packager-map
fis3-errors@* installed at node_modules/.0.0.4@fis3-errors
lodash@4.12.0 installed at node_modules/.4.12.0@lodash
fis-command-install@0.2.17 installed at node_modules/.0.2.17@fis-command-install
fis3-server-node@0.1.1 installed at node_modules/.0.1.1@fis3-server-node
fsevents@1.0.17 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"}
fis3-deploy-http-push@2.0.5 installed at node_modules/.2.0.5@fis3-deploy-http-push
fis3-command-release@1.3.12 installed at node_modules/.1.3.12@fis3-command-release
fis-spriter-csssprites@0.3.11 installed at node_modules/.0.3.11@fis-spriter-csssprites
fis-optimizer-png-compressor@0.1.6 installed at node_modules/.0.1.6@fis-optimizer-png-compressor
execute post install scripts...
scripts.install fis3-command-release@1.3.12 › chokidar@1.4.3 › fsevents@1.0.17 run "node-pre-gyp install --fallback-to-build"
[fsevents] Success: "/usr/local/lib/node_modules/fis3/node_modules/.1.0.17@fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
scripts.install fis3-command-release@1.3.12 › chokidar@1.4.3 › fsevents@1.0.17 finished in 313ms
scripts.install fis-optimizer-png-compressor@0.1.6 › node-pngquant-native@1.0.4 run "echo \"Hello, World\""
Hello, World
scripts.install fis-optimizer-png-compressor@0.1.6 › node-pngquant-native@1.0.4 finished in 6ms
scripts.install fis-spriter-csssprites@0.3.11 › images@3.0.0 run "echo \"Hello, World.\""
Hello, World.
scripts.install fis-spriter-csssprites@0.3.11 › images@3.0.0 finished in 5ms
scripts.install fis-optimizer-png-compressor@0.1.6 › node-pngcrush@0.3.7 run "echo \"Hello, World.\""
Hello, World.
scripts.install fis-optimizer-png-compressor@0.1.6 › node-pngcrush@0.3.7 finished in 5ms
deprecate minimatch@2.0.4 Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
deprecate glob@5.0.3 › minimatch@2.0.10 Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
deprecate fis-command-install@0.2.17 › fis-scaffold-kernel@0.2.0 › fis-repo-client@0.1.14 › request@2.27.0 › node-uuid@1.4.7 use uuid module instead
All packages installed (317 packages installed from npm registry, used 16s, speed 2.19MB/s, json 353(2.38MB), tarball 31.94MB)
Recently updated (since 2017-01-03): 2 packages (detail see file /usr/local/lib/node_modules/fis3/node_modules/.recently_updates.txt)
  2017-01-05
    → fis3-command-release@1.3.12 › chokidar@1.4.3 › fsevents@1.0.17 (06:25:53)
  2017-01-04
    → fis-command-install@0.2.17 › fis-scaffold-kernel@0.2.0 › prompt@0.2.14 › read@1.0.7 › mute-stream@0.0.7 (06:47:53)
[fis3@3.4.31] link /usr/local/bin/fis3@ -> /usr/local/lib/node_modules/fis3/bin/fis.js

出現如讓提示,恭喜你安裝成功,讓我們來檢測一下:

$ fis3 -v

終端輸出如下:


[INFO] Currently running fis3 (/usr/local/lib/node_modules/fis3/)

  v3.4.31

   /\\\\\\\\\\\\\\\  /\\\\\\\\\\\     /\\\\\\\\\\\   
   \/\\\///////////  \/////\\\///    /\\\/////////\\\        
    \/\\\                 \/\\\      \//\\\      \///  
     \/\\\\\\\\\\\         \/\\\       \////\\\              
      \/\\\///////          \/\\\          \////\\\          
       \/\\\                 \/\\\             \////\\\      
        \/\\\                 \/\\\      /\\\      \//\\\  
         \/\\\              /\\\\\\\\\\\ \///\\\\\\\\\\\/   
          \///              \///////////    \///////////     

相關文章