You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, this broke in 12.1.0 (so 12.0.0 worked) and is "related" to #21049 (but it looks like it's a bug(?)/change in Node and might also break rimraf).
Description
When trying to build on a clean environment (such as a CI) the builder will try to delete the output path which does not exist. On Node 16 this is an error and {recursive: true} does not silence this error.
A clear and concise description of the problem...
🔬 Minimal Reproduction
docker run --rm node:latest -e 'fs.rmdirSync("/this/does/not/exist", {recursive: true, maxRetries: 3})'
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, stat '/this/does/not/exist'
at Object.statSync (node:fs:1527:3)
at __node_internal_ (node:internal/fs/utils:767:8)
at Object.rmdirSync (node:fs:1147:15)
at [eval]:1:4
at Script.runInThisContext (node:vm:131:12)
at Object.runInThisContext (node:vm:308:38)
at node:internal/process/execution:81:19
at [eval]-wrapper:6:22
at evalScript (node:internal/process/execution:80:60)
at node:internal/main/eval_string:27:3 {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/this/does/not/exist'
}
🔥 Exception or Error
output is from docker build with buildkit so that's the prefix
#27 0.664 + npm run build
#27 1.556
#27 1.556 > [email protected] build
#27 1.556 > ng build
#27 1.556
#27 8.243 An unhandled exception occurred: ENOENT: no such file or directory, stat '/code/app'
#27 8.243 See "/tmp/ng-1XRgEQ/angular-errors.log" for further details.
#27 8.278 + EXIT_CODE=127
#27 8.278 + tail -n +1 /tmp/ng-1XRgEQ/angular-errors.log
#27 8.278 [error] Error: ENOENT: no such file or directory, stat '/code/app'
#27 8.278 at Object.statSync (node:fs:1527:3)
#27 8.278 at __node_internal_ (node:internal/fs/utils:767:8)
#27 8.278 at Object.rmdirSync (node:fs:1147:15)
#27 8.278 at Object.deleteOutputDir (/code/node_modules/@angular-devkit/build-angular/src/utils/delete-output-dir.js:21:10)
#27 8.278 at initialize (/code/node_modules/@angular-devkit/build-angular/src/browser/index.js:86:17)
#27 8.278 at async SwitchMapSubscriber.project (/code/node_modules/@angular-devkit/build-angular/src/browser/index.js:114:17)
…g the output path
According to `rmdirSync` [1] the `recursive` option is deprecated. The
wording looks like it was changed (compared to Node LTS [2]) to not
include anything about ignoring errors on paths not existing. In the
future the call should be `rmSync(..., {..., force: true})`, but when
testing locally adding a "force" option does not restore the previous
behavior. This isn't documented to work, but since the code original
code is deprecated I was wondering if the underlying functionality was
just passing all the options `rmSync` on Node 16.
This change includes an existence check to skip deleting a non existent
directory.
closes: angular#21216
[1]: https://nodejs.org/api/fs.html#fs_fs_rmdirsync_path_options
[2]: https://nodejs.org/docs/latest-v14.x/api/fs.html#fs_fs_rmdirsync_path_options
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, this broke in 12.1.0 (so 12.0.0 worked) and is "related" to #21049 (but it looks like it's a bug(?)/change in Node and might also break rimraf).
Description
When trying to build on a clean environment (such as a CI) the builder will try to delete the output path which does not exist. On Node 16 this is an error and
A clear and concise description of the problem...{recursive: true}
does not silence this error.🔬 Minimal Reproduction
🔥 Exception or Error
output is from docker build with buildkit so that's the prefix
🌍 Your Environment
Anything else relevant?
Running with
--no-delete-output-path
will fix the error.The text was updated successfully, but these errors were encountered: