angular-cli: Permission error on second build when nomodule polyfill is included
π Bug report
Command (mark with an x
)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Iβm not sure. This is the first time Iβve seen it, but I recently upgraded to Angular 8.
Description
I reproducibly get a permission error, seen below, in a clean, brand new angular project, when browserslist specifies browsers that require nomodule polyfill.
π¬ Minimal Reproduction
ng new test
- In the new project, add to browserslist:
ios_saf >= 10
ng build --prod
ng build --prod
(again)
π₯ Exception or Error
chunk {0} runtime-es2015.24b02acc1f369d9b9f37.js (runtime) 2.83 kB [entry] [rendered]
chunk {1} main-es2015.7c221f45d48105c2ba9d.js (main) 251 kB [initial] [rendered]
chunk {2} polyfills-es2015.fd917e7c3ed57f282ee5.js (polyfills) 64.3 kB [initial] [rendered]
chunk {3} polyfills-es5-es2015.3aa54d3e5134f5b5b842.js (polyfills-es5) 223 kB [initial] [rendered]
chunk {4} styles.3ff695c00d717f2d2a11.css (styles) 0 bytes [initial] [rendered]
chunk {polyfills-nomodule-es5} polyfills-nomodule-es5.b79bfebc521ac1ea1602.js (polyfills-nomodule-es5) 372 bytes [entry] [rendered]
Date: 2019-08-30T21:28:19.886Z - Hash: c40b7c3c8a049ad41deb - Time: 12280ms
Generating ES5 bundles for differential loading...
An unhandled exception occurred: EACCES: permission denied, copyfile '/Users/karp/Documents/git/outputhashing2/node_modules/.cache/angular-build-dl/content-v2/sha512/f3/26/48b77841506560fd29c0954a8fe431f253a24b4306fd7399aaec8a09d0dcc974a357856c0b742e8e40a0ac34f406ebc3b58955f738ea327fc8e1819cd7a3' -> '/Users/karp/Documents/git/outputhashing2/dist/outputhashing2/polyfills-nomodule-es5.b79bfebc521ac1ea1602.js'
See "/private/var/folders/pf/z4z5f17x7jb0n0m44bmkhyw00000gn/T/ng-7tYGDL/angular-errors.log" for further details.
π Your Environment
Angular CLI: 8.3.2
Node: 10.16.0
OS: darwin x64
Angular: 8.2.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.2
@angular-devkit/build-angular 0.803.2
@angular-devkit/build-optimizer 0.803.2
@angular-devkit/build-webpack 0.803.2
@angular-devkit/core 8.3.2
@angular-devkit/schematics 8.3.2
@angular/cli 8.3.2
@ngtools/webpack 8.3.2
@schematics/angular 8.3.2
@schematics/update 0.803.2
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2
Anything else relevant?
Nuking node_module
(and presumably just the cache dir within) and reinstalling fixes the issue for one build.
Sorry to put this out there on a Friday afternoon!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 25 (2 by maintainers)
Commits related to this issue
- fix(@angular-devkit/build-angular): fix permission errors for ES5 bundles copyFilesSync will also copy permissions which may result in permissions errors. Closes #15490 — committed to angular/angular-cli by alan-agius4 5 years ago
- fix(@angular-devkit/build-angular): fix permission errors for ES5 bundles copyFilesSync will also copy permissions which may result in permissions errors. Closes #15490 — committed to angular/angular-cli by alan-agius4 5 years ago
Some other users also seem to experience
An unhandled exception occurred: EEXIST: file already exists, copyfile
wow thanks guys! I solved itβ¦
I was using
nvm
with the latest versionv11.12.0
β¦solution was to use the stable Node!
I had the same problem and after removing node_modules and
npm install
it works as it should be.If anyone is encountering the EEXIST error on MacOS, please try a node version of 10.16.0 or greater. There is a known issue with copying files on earlier versions of node for MacOS.
Iβm no expert, but Iβd suggest, if you are still having this problem with the latest Angular CLI, completely deleting node_modules, and re-installing. Then, if you are still having the problem, report this as a new related issue (with a link to this one), since this issue is closed, and was fixed, at least for the case reported originally.
@jjz4689 my assumption is that some data in the npm cache was causing the issue. Worked for me π
@pagimaxx I had the same issue, but it was resolved after running
npm ci
. Give that a shotSame problem with:
Can someone help me on this, I am getting this error βEEXIST: file already exists, mkdirβ when I execute
ng build --prod
with--output-path
flag specified.I have:
@clydin Thank you very much for pointing me in the right direction, indeed my problems went away by updating. Also my concern about the file mode setting is obsolete with commit 0cb10d6029f59842b2f6e0a791d78b43ea1a7460.