npm WARN lifecycle yarn@1.22.19~preinstall: cannot run in wd %s %s

Posted 柳鲲鹏

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm WARN lifecycle yarn@1.22.19~preinstall: cannot run in wd %s %s相关的知识,希望对你有一定的参考价值。

  • 具体错误
tsit@ubuntu:/usr$ sudo npm install -g yarn
npm WARN lifecycle yarn@1.22.19~preinstall: cannot run in wd %s %s (wd=%s) yarn@1.22.19 :; (node ./preinstall.js > /dev/null 2>&1 || true) /usr/local/lib/node_modules/.staging/yarn-53412bb0
  • 解决办法

加上--unsafe-perm

sudo npm install --unsafe-perm -g yarn

> yarn@1.22.19 preinstall /usr/local/lib/node_modules/.staging/yarn-53412bb0
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

/usr/local/bin/yarn -> /usr/local/lib/node_modules/yarn/bin/yarn.js
/usr/local/bin/yarnpkg -> /usr/local/lib/node_modules/yarn/bin/yarn.js
/usr/local/lib
└── yarn@1.22.19 

以上是关于npm WARN lifecycle yarn@1.22.19~preinstall: cannot run in wd %s %s的主要内容,如果未能解决你的问题,请参考以下文章

关于npm包,react-lifecycles-compat

text npm WARN版本无效

安装vue命令行工具(CLI),npm WARN

使用npm安装包报错“npm WARN npm npm does not support Node.js v17.1.0“

一文简述npm和cnpm和yarn的区别

通过 npm 安装后找不到 yarn 命令