mar*_*oet 7 ubuntu node.js azure-pipelines
我们使用 Azure Pipelines 和使用 Ubuntu 18.04 作为操作系统的构建代理。
\n我目前正在尝试将管道中的 Nodejs 版本从 16 更新到 18。通过使用Azure Pipelines 中的 NodeTool 任务和versionSpec: "18.x".
然而,在使用 Nodejs 之后,它提示我缺少依赖项:\nnode: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28\' not found (required by node)\\
我什至可以使用 docker 按照以下说明复制此行为
\ndocker pull ubuntu:18.04\ndocker run -it {IMAGE-ID}\n\n# console switches to TTY session for running container\xe2\x80\xa6\n\napt update\napt install curl\ncurl -fsSL https://deb.nodesource.com/setup_18.x | bash\napt-get install -y nodejs\n\n# checking the node version generates the error above\n\nnode -v\nRun Code Online (Sandbox Code Playgroud)\n这里的问题可能有点过分了,但我不习惯使用linux系统。
\n我可以轻松解决 Nodejs 的这种依赖关系吗?\n或者这里安装缺少的依赖关系的一般方法是什么?
\n此消息是在您上面提到的安装过程中出现的。
## Run sudo apt-get install -y nodejs` to install Node.js 18.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/enter code hereshare/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-enter code hereby=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.denter code here/yarn.list
sudo apt-get update && sudo apt-get install yarn
Run Code Online (Sandbox Code Playgroud)
我尝试过,但仍然遇到同样的错误。
经过一番研究后发现,node 18 和 ubuntu 18 不兼容。
https://github.com/nodesource/distributions/issues/1392
如果你用谷歌搜索这个错误,你会发现更多关于这个问题的信息。
更新到 ubuntu 20.04 应该可以解决该问题。如果您由于除 Nodejs 之外的其他原因不需要 ubuntu,我建议您尝试 Node:18-alpine。(官方 Nodejs 图像之一)。Alpine 比 ubuntu 轻量得多。
| 归档时间: |
|
| 查看次数: |
14257 次 |
| 最近记录: |