我目前的版本
node14.15.1
npm 6.16.8
cnpm 6.1.1

执行 cnpm install 总是报下面这个错误,是 npm 和 cnpm 版本兼容问题。

localhost:shuntian-pc-client lvtao0420$ cnpm install
✖ Install fail! Error: Unsupported URL Type: npm:string-width@^4.2.0
Error: Unsupported URL Type: npm:string-width@^4.2.0
    at parseUrl (/usr/local/lib/node_modules/cnpm/node_modules/npm-package-arg/npa.js:186:13)
    at npa (/usr/local/lib/node_modules/cnpm/node_modules/npm-package-arg/npa.js:79:12)
    at _install (/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/install.js:62:11)
    at _install.next (<anonymous>)
    at onFulfilled (/usr/local/lib/node_modules/cnpm/node_modules/co/index.js:65:19)
    at /usr/local/lib/node_modules/cnpm/node_modules/co/index.js:54:5
    at new Promise (<anonymous>)
    at co (/usr/local/lib/node_modules/cnpm/node_modules/co/index.js:50:10)
    at toPromise (/usr/local/lib/node_modules/cnpm/node_modules/co/index.js:118:63)
    at next (/usr/local/lib/node_modules/cnpm/node_modules/co/index.js:99:29)

解决办法,macOS系统安装node版本管理工具n

sudo npm i -g n
sudo n 16.15.0
npm i -g cnpm
cnpm i -g cnpm

最后执行 cnpm install 成功。

在这里插入图片描述

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐