发生系统错误:uv_os_get_passwd返回 ENOENT(没有此类文件或目录)



我有一个 jenkin 管道,当我运行 ember build 时,它会在 docker 代理上运行,我收到此错误。 知道我该怎么办.我使用

image 'node:latest'

我收到此错误

+ ./node_modules/.bin/ember build --env production
WARNING: Node v14.3.0 is not tested against Ember CLI on your platform. We recommend that you use the most-recent "Active LTS" version of Node.js. See https://git.io/v7S5n for details.
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
Building
A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)

原来我需要做的就是将 docker volumne 映射从/etc/passwd 添加到/etc/passwd。

agent {
docker { 
image 'node:12'
args "-v /etc/passwd:/etc/passwd"
reuseNode true
}
}

此问题可能会掩盖在容器中使用node-gyp时缺少或只读路径的另一个问题。

os.userInfo()用法是 eaccesFallback 的一部分,只有在无法访问文件路径时才应调用该

用法。打开详细日志记录 (npm_config_loglevel=verbose( 以记录无法访问的路径并挂载/修复它。

根据我的经验,这解决了根本问题并避免了可能并不总是可能或可能被视为不安全的安装/etc/passwd

我在使用electron-builder时特别在 k8s pods 中看到了这一点,并且不得不为.electron-gyp文件夹创建一个空的卷挂载:

volumeMounts:
- name: electron-cache
mountPath: /.electron-gyp
volumes:
- name: electron-cache
emptyDir: {}

相关内容

最新更新