【发布时间】:2021-06-29 06:57:04
【问题描述】:
我有一个在某个时候运行npm install 的powershell 构建脚本。
我在网上搜索了这个问题,但找不到任何有用的东西。我看到有人建议在 Windows Defender 中为 jenkins 文件夹添加一个例外,因为它正在锁定文件。我做到了,仍然没有运气。
我不认为脚本对我有任何锁定,我只是在运行 npm install。 奇怪的是,这并不总是发生,有时有效,有时无效。
26610 verbose stack Error: EPERM: operation not permitted, unlink 'C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js'
26612 verbose Windows_NT 10.0.18363
26613 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
26614 verbose node v12.18.2
26615 verbose npm v6.14.5
26616 error code EPERM
26617 error syscall unlink
26618 error path C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js
26619 error errno -4048
26620 error Error: EPERM: operation not permitted, unlink 'C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js'
26620 error [OperationalError: EPERM: operation not permitted, unlink 'C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js'] {
26620 error cause: [Error: EPERM: operation not permitted, unlink 'C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js'] {
26620 error errno: -4048,
26620 error code: 'EPERM',
26620 error syscall: 'unlink',
26620 error path: 'C:\\Jenkins\\workspace\\...\\node_modules\\.staging\\highcharts-705cfa89\\highcharts.src.js'
26620 error },
26620 error errno: -4048,
26620 error code: 'EPERM',
26620 error syscall: 'unlink',
26620 error path: 'C:\\Jenkins\\workspace\\...\\node_modules\\.staging\\highcharts-705cfa89\\highcharts.src.js',
26620 error parent: 'react'
26620 error }
26621 error The operation was rejected by your operating system.
26621 error It's possible that the file was already in use (by a text editor or antivirus),
26621 error or that you lack permissions to access it.
26621 error
26621 error If you believe this might be a permissions issue, please double-check the
26621 error permissions of the file and its containing directories, or try running
26621 error the command again as root/Administrator.
26622 verbose exit [ -4048, true ]
【问题讨论】:
-
您是否检查了文件夹的正确权限。
-
正确是什么意思?我在窗户上,我会告诉你我看到的。
SYSTEM拥有完全控制权,<my_user>\Administrators也是如此。还需要吗? -
如果它只是偶尔发生,您能否提供有关您的 jenkins 设置的更多信息 - 例如这个构建是否总是在同一个构建代理上运行?您是否在容器中运行此阶段?
-
我不知道我可以提供什么相关信息,我没有想到任何不寻常的事情。构建在同一个代理上运行,是的。