写这篇文章是为了解决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
/\\\\\\\\\\\\\\\ /\\\\\\\\\\\ /\\\\\\\\\\\
\/\\\/////////// \/////\\\/// /\\\/////////\\\
\/\\\ \/\\\ \//\\\ \///
\/\\\\\\\\\\\ \/\\\ \////\\\
\/\\\/////// \/\\\ \////\\\
\/\\\ \/\\\ \////\\\
\/\\\ \/\\\ /\\\ \//\\\
\/\\\ /\\\\\\\\\\\ \///\\\\\\\\\\\/
\/// \/////////// \///////////
网友评论