pnpm命令一直不存在,应该怎么才能生效

2024-03-12T12:23:00

宝塔nodejs安装pnpm后在终端输入pnpm -v等却返回找不到命令
通过插件安装的pnpm默认不会添加到系统环境变量,需要自己手动来指定目录来运行的。
例如您所安装的node版本是v16.20.2,那您安装的pnpm的路径则在/www/server/nodejs/v16.20.2/bin/pnpm
需要执行命令

ln -sf /www/server/nodejs/v16.20.2/lib/node_modules/pnpm/bin/pnpm.cjs /usr/bin/pnpm

另外有些地方npm需要进行修改,修改文件/www/server/nodejs/v16.20.2/etc/npmrc,将inin.module前面添加--

--init.module = /www/server/nodejs/v16.20.2/etc/init-module.js
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »