Azure 应用服务安装错误: EACCES: 权限被拒绝, mkdir '/opt/Kudu/local/npm-cache'。

3

我试图同步与Bitbucket链接的应用程序服务。当我尝试从Bitbucket同步数据时,它显示以下错误信息: info 有关此命令的文档,请访问https://yarnpkg.com/en/docs/cli/install。 error /tmp/8da38dcb36cf63a/node_modules/sharp: 命令失败。 退出代码: 1 命令:(node install/libvips & amp;& node install/dll-copy & amp;& amp; prebuild-install) || (node install/can-compile & amp;& amp; node-gyp rebuild & amp;& amp; node install/dll-copy) 参数: 目录:/tmp/8da38dcb36cf63a/node_modules/sharp 输出: sharp:安装错误:EACCES:权限被拒绝,mkdir '/opt/Kudu/local/npm-cache' sharp:您是尝试使用root或sudo用户安装吗?请再次使用--unsafe-perm标志重试 sharp:请参阅https://sharp.pixelplumbing.com/install查看所需的依赖项 警告"@strapi/plugin-users-permissions>@strapi/helper-plugin 谁能帮我解决问题? 解决方案是什么? enter image description here


面对类似问题,请告知是否已经解决。 - Shakir Shakeel
1个回答

5
问题是它在npm-cache文件夹上执行“npm install”,但没有权限这样做。
我通过在Azure上创建一个新的“应用设置”解决了这个问题,名称为“PRE_BUILD_COMMAND”,其值为:“mkdir ./npmcache && npm config set cache ./npmcache”。
在yarn/npm安装和构建之前,执行此命令。它创建一个具有写权限的新文件夹,然后将此文件夹设置为npm缓存文件夹。

这对我有用,谢谢分享。值得注意的是,“Application Setting”在其他平台上也被翻译为“环境变量”,例如Vercel。 - Morgan Feeney
1
这应该被标记为一个被接受的答案。 - mac125

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接