Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running build with --prod twice gives EEXIST error. #15494

Closed
bennadel opened this issue Aug 31, 2019 · 2 comments
Closed

Running build with --prod twice gives EEXIST error. #15494

bennadel opened this issue Aug 31, 2019 · 2 comments

Comments

@bennadel
Copy link

🐞 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 am mostly sure this is a regression. When I was on "8 next", I could run build more than once (not sure which version the CLI was at the time). But, on "9 next", or just the current ng new, it seems to break.

Description

I just did an ng new command. Then, going into the project, if I run this twice in a row:

npm run build -- --prod

... it will work the first time. But, upon the second execution, I get the EEXIST error:

> ng build "--prod"

chunk {0} runtime-es2015.24b02acc1f369d9b9f37.js (runtime) 2.83 kB [entry] [rendered]
chunk {1} main-es2015.c1ca90f926552c3d2864.js (main) 369 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]
Date: 2019-08-31T10:44:47.301Z - Hash: ac5960e989c86bda1855 - Time: 16200ms
Generating ES5 bundles for differential loading...
An unhandled exception occurred: EEXIST: file already exists, copyfile '/Users/ben/Sites/bennadel.com/projects/breadboarding-poc-cli/node_modules/.cache/angular-build-dl/content-v2/sha512/36/86/afb82f76da09848c154ccb79a5213dc67698763412e526216fbce17a94bd0b1762da3627677b3ee97a05cdc837739fdc4dbdc08b13fbd50cbb0fb9a0b512' -> '/Users/ben/Sites/bennadel.com/projects/breadboarding-poc-cli/dist/breadboarding-poc-cli/runtime-es2015.24b02acc1f369d9b9f37.js'
See "/private/var/folders/49/h6_w8znd50vgwbbbwdxqsmlh0000gn/T/ng-c1s0RZ/angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] build: `ng build "--prod"`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ben/.npm/_logs/2019-08-31T10_44_47_385Z-debug.log

Note that if I remove the --prod, I can run multiple builds without issue. Also note that if I delete the node_modules/.cache folder, I can re-run the prod build.

🔬 Minimal Reproduction

  1. Create a new project with the CLI, ng new test
  2. Go into test, cd test
  3. Run build with prod flag, npm run build -- --prod
  4. Run build with prod flag npm run build -- --prod

The first build will work, the second build will break.

🔥 Exception or Error


ip-192-168-0-18:breadboarding-poc-cli ben$ npm run build -- --prod

> [email protected] build /Users/ben/Sites/bennadel.com/projects/breadboarding-poc-cli
> ng build "--prod"


chunk {0} runtime-es2015.24b02acc1f369d9b9f37.js (runtime) 2.83 kB [entry] [rendered]
chunk {1} main-es2015.c1ca90f926552c3d2864.js (main) 369 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]
Date: 2019-08-31T10:44:47.301Z - Hash: ac5960e989c86bda1855 - Time: 16200ms
Generating ES5 bundles for differential loading...
An unhandled exception occurred: EEXIST: file already exists, copyfile '/Users/ben/Sites/bennadel.com/projects/breadboarding-poc-cli/node_modules/.cache/angular-build-dl/content-v2/sha512/36/86/afb82f76da09848c154ccb79a5213dc67698763412e526216fbce17a94bd0b1762da3627677b3ee97a05cdc837739fdc4dbdc08b13fbd50cbb0fb9a0b512' -> '/Users/ben/Sites/bennadel.com/projects/breadboarding-poc-cli/dist/breadboarding-poc-cli/runtime-es2015.24b02acc1f369d9b9f37.js'
See "/private/var/folders/49/h6_w8znd50vgwbbbwdxqsmlh0000gn/T/ng-c1s0RZ/angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] build: `ng build "--prod"`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ben/.npm/_logs/2019-08-31T10_44_47_385Z-debug.log

🌍 Your Environment


Angular CLI: 8.3.2
Node: 10.11.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?

No, I don't think so.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Aug 31, 2019

Duplicate/related to #15490

@alan-agius4 alan-agius4 marked this as a duplicate of #15490 Aug 31, 2019
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants