angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Permission error on second build when nomodule polyfill is included

Open karptonite opened this issue 7 years ago β€’ 25 comments

🐞 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

  1. ng new test
  2. In the new project, add to browserslist: ios_saf >= 10
  3. ng build --prod
  4. 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!

karptonite avatar Aug 30 '19 21:08 karptonite

wow thanks guys! I solved it...

I was using nvm with the latest version v11.12.0...

solution was to use the stable Node!

nvm install v10.16.3
nvm use v10.16.3

robvaneck avatar Sep 09 '19 18:09 robvaneck

I was getting the same issue running "npm run electron-build" which of course does an "ng build --prod". I was using node 11.6.0. I installed n from npm and got node 10.16.3, 11.15.0 and 12.10.0...

When I used node version 10x or 12x everything was fine, but with node version 11x the problem just will not go away.

https://www.surrealcms.com/blog/how-to-upgrade-or-downgrade-nodejs-using-npm.html

wkande avatar Sep 09 '19 22:09 wkande

I had the same problem and after removing node_modules and npm install it works as it should be.

this helped me as well - deleting and re-installing node_modules

svkozak avatar Sep 13 '19 16:09 svkozak

Apparently, error mentioned a node_modules/.cache directory where the file mentioned in error is located. I just delete node_modules/.cache directory, launch ng build --prod again and it works!

aclarturocastro avatar Sep 30 '19 20:09 aclarturocastro

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.