在ubuntu中安装cnpm,运行 sudo npm install cnpm -g
安装成功,运行cnpm却报如下错误 ucsheep@ucsheep-B250M-D2V:~$ sudo npm install cnpm -g npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0 /opt/node-v11.4.0-linux-x64/bin/cnpm -> /opt/node-v11.4.0-linux-x64/lib/node_modules/cnpm/bin/cnpm + cnpm@6.0.0 updated 1 package in 9.46s ucsheep@ucsheep-B250M-D2V:~$ cnpm 未找到 'cnpm' 命令,您要输入的是否是: 命令 'cxpm' 来自于包 'xpmutils' (universe) 命令 'npm' 来自于包 'npm' (universe) 命令 'cpm' 来自于包 'cpm' (universe) cnpm:未找到命令
应该是无法正确建立软链,我们手动建立一下
1 sudo find / -name cnpm
先查到cnpm位置,在 /opt/node-v11.4.0-linux-x64/lib/node_modules/cnpm/bin/cnpm
2 sudo ln -s /opt/node-v11.4.0-linux-x64/lib/node_modules/cnpm/bin/cnpm /usr/local/bin/cnpm
建立软链
3 ucsheep@ucsheep-B250M-D2V:~$ cnpm -version cnpm@6.0.0 (/opt/node-v11.4.0-linux-x64/lib/node_modules/cnpm/lib/parse_argv.js) npm@6.5.0 (/opt/node-v11.4.0-linux-x64/lib/node_modules/cnpm/node_modules/npm/lib/npm.js) node@11.4.0 (/opt/node-v11.4.0-linux-x64/bin/node) npminstall@3.17.0 (/opt/node-v11.4.0-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js) prefix=/opt/node-v11.4.0-linux-x64 linux x64 4.15.0-42-generic registry=https://registry.npm.taobao.org
测试,可以用了