尝试使用Azure管道进行部署时遇到错误。
std::string::size_type n;
n = s.find("--"); // Find the first instance of "--"
// Find returns npos if there is no match
while (n != std::string::npos) // Loop while there is a match
{
s.replace(n, 2, " - "); // Replace "--" with " - "
n = s.find("--", n + 3); // Find the next match, starting at the character after the " - " that we just added
}
我认为它是因为在阶段之间未共享node_modules文件夹。但是我不知道什么是正确的方法。
这是我的Yaml文件:
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
运行npm install之后,软件包node_modules应该出现在目录中,但是似乎未正确共享。
答案 0 :(得分:1)
您正在使用Ubuntu
映像,并尝试在没有netlify-cli
的 Linux中全局安装sudo
。
如果Ubuntu
是必须使用的必要系统,则最好在此命令前添加sudo
:
sudo npm i -g netlify-cli
Command succeed on my pipeline
在此文档中,Upgrading on *nix (OSX, Linux, etc.):
您可能需要为这些命令添加sudo前缀,尤其是在Linux上, 或OS X(如果使用默认安装程序安装了Node)。
与VSTS相同,您必须在命令中使用sudo
,以使您拥有Ubuntu
的无密码sudo权限。
如果您对构建环境没有任何特殊要求,另一种方法是将映像更改为vs2017-win2016
:
pool:
vmImage: 'vs2017-win2016'
使用此映像时,您可以安装任何东西,而无需使用sudo
。
事实上,我们已经在所有托管映像中预装了许多基本工具,包括node.js
在我们的github description中,我们列出了为所有图像预先安装的所有工具。您可以检查以了解有关VSTS的更多信息。