首页 > 解决方案 > 如何在 Azure Web 服务上升级 yarn 并使 yarn 工作区正常工作

问题描述

我无法让纱线工作区在 Azure Web 服务上运行,也无法升级纱线。

我有一个部署为 Azure Web 服务的应用程序。它使用纱线工作区。不幸的是,yarn install在错误发生期间

[3/4] Linking dependencies...
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/home/site/wwwroot/node_modules/@gsx/common'".
info If you think this is a bug, please open a bug report with the information provided in "/home/site/wwwroot/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

我读到升级纱线可以解决问题。Azure 默认自带 yarn 1.6.0。

我的存储库中有deploy.sh文件,因此我可以自定义部署过程。我想添加命令来升级纱线。

我试图通过两种方式实现它:

npm install -g yarn

sudo npm install -g yarn

他们两个都失败了。在第一种情况下,我收到一条消息,说我没有足够的权限。在第二个日志中说没有命令sudo

你有什么想法,我怎样才能升级纱线?

标签: node.jsazureyarnpkgazure-web-app-serviceyarn-workspaces

解决方案


请看一下这个repo 并试一试。您所要做的就是将deploy.cmd.deployment文件从上述存储库复制到您的,这将使 Kudu 使用此脚本而不是默认脚本。希望这可以帮助。


推荐阅读