angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.98k forks source link

ng build -prod fails to clean up files #1068

Closed lamaan closed 8 years ago

lamaan commented 8 years ago

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows 10
  2. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version And paste the result here. angular-cli: 1.0.0-beta.5 node: 5.6.0 os: win32 x64
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc. ng build works fine but ng build -prod fails giving error below. You can reproduce with my code from https://github.com/lamaan/angular2-salah-times
  4. The log given by the failure. Normally this include a stack trace and some more information. C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times>ng build -prod Cleanup error. ENOTEMPTY: directory not empty, rmdir 'C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\tmp\broccoli_type_script_compiler-cache_path-973l28 5M.tmp\src\app' Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\tmp\broccoli_type_script_compiler-cache_path -973l285M.tmp\src\app' at Error (native) at Object.fs.rmdirSync (fs.js:806:18) at rmkidsSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:247:11) at rmdirSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:237:7) at fixWinEPERMSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:150:5) at rimrafSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:216:26) at C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:245:5 at Array.forEach (native) at rmkidsSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:244:26) at rmdirSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:237:7) at fixWinEPERMSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:150:5) at rimrafSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:216:26) at C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:245:5 at Array.forEach (native) at rmkidsSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:244:26) at rmdirSync (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\quick-temp\node_modules\rimraf\rimraf.js:237:7) Build failed. The Broccoli Plugin: [BundlePlugin] failed with: Error on fetch for angular2-google-maps/core.js at file:///C:/Users/Lamaan/AAAWork/shariahstandards.org/app/angular2-salah-times/tmp/bundle_plugin-input_base_pa th-XrdEiDow.tmp/0/angular2-google-maps/core.js Loading main.js Error: ENOENT: no such file or directory, open 'C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\tmp\bundle_plugin-input_base_path- XrdEiDow.tmp\0\angular2-google-maps\core.js' at Error (native)

The broccoli plugin was instantiated at: at BundlePlugin.Plugin (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\broccoli-plugin\index.js:10:31) at BundlePlugin.CachingWriter as constructor at BundlePlugin (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\angular-cli\lib\broccoli\angular-broccoli-bundle.js:10:3 6) at Angular2App._getBundleTree (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\angular-cli\lib\broccoli\angular2-app.js:4 21:22) at Angular2App._buildTree (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\angular-cli\lib\broccoli\angular2-app.js:159:2 1) at new Angular2App (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\angular-cli\lib\broccoli\angular2-app.js:53:23) at module.exports (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\angular-cli-build.js:8:10) at Class.module.exports.Task.extend.setupBroccoliBuilder (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\angular-cli\lib \models\builder.js:55:19) at Class.module.exports.Task.extend.init (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\angular-cli\lib\models\builder. js:89:10) at new Class (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\core-object\core-object.js:18:12) at Class.module.exports.Task.extend.run (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\angular-cli\lib\tasks\build.js:1 5:19) at C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\angular-cli\lib\commands\build.js:32:24 at lib$rsvp$$internal$$tryCatch (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\rsvp\dist\rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\rsvp\dist\rsvp.js:1048:17) at lib$rsvp$$internal$$publish (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\rsvp\dist\rsvp.js:1019:11) at lib$rsvp$asap$$flush (C:\Users\Lamaan\AAAWork\shariahstandards.org\app\angular2-salah-times\node_modules\rsvp\dist\rsvp.js:1198:9)

  1. Mention any other details that might be useful.
lamaan commented 8 years ago

this was just windows not deleting files correctly and some other config errors which have now been resolved

SijanC147 commented 8 years ago

I know this is closed but I'm facing the very same issue and was wondering how did you resolve this?

lamaan commented 8 years ago

Just had to delete the tmp folder manually. Initially, it was quite large. But now, I rarely get the problem.

-----Original Message----- From: "Sean" notifications@github.com Sent: ‎15/‎06/‎2016 06:46 To: "angular/angular-cli" angular-cli@noreply.github.com Cc: "lamaan" lamaan@lamaan.com; "State change" state_change@noreply.github.com Subject: Re: [angular/angular-cli] ng build -prod fails to clean up files (#1068)

I know this is closed but I'm facing the very same issue and was wondering how did you resolve this?


You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub: https://github.com/angular/angular-cli/issues/1068#issuecomment-226093773

NgxDev commented 8 years ago

angular-cli version: 1.0.0-beta.10

I still get the error. But here's what's causing it for me:

In my "app" folder I have a "+static" folder, in which I've created an index.ts (as the styleguide recommends):

export * from './contact';
export * from './privacy';
export * from './support';
export * from './terms-and-conditions';

In the same "+static" folder, I have all the necessary components, each in it's own folder: contact, privacy etc. Each of these folders also has an index.ts with export * from './name-of.component';

Then, in my app.routes.ts I have:

import {
    ContactComponent,
    PrivacyComponent,
    SupportComponent,
    TermsAndConditionsComponent
} from './+static';

and, in my system-config.ts I have the following barrels (created automatically by the cli):

const barrels: string[] = [
    // ...
    'app/+static/contact',
    'app/+static/privacy',
    'app/+static/support',
    'app/+static/terms-and-conditions'
]

Tried the following:

  1. In my system-config.ts, instead of all those barrels, just put app/+static. Doesn't work.
  2. In my app.routes.ts, instead of the import { .. } from './+static'; I've actually wrote an import for each component (import { ContactComponent } from './+static/contact';. This works, I don't get the error anymore. But this means the index.ts in my +static folder is useless. And, as far as I know, the styleguide recommends the use of an index.ts specifically to have less import statements (like I was trying, to import { Component1, Component2, Component3 ... } from './+static'; So, I'm wondering... If they recommend it, it should work... But it doesn't work. Am I doing something wrong? Or is it a bug? And I should open one accordingly, with the exact scenario I have?
filipesilva commented 8 years ago

@MrCroft I can't say one way or another if it's a build bug or a code bug, but since we're moving away from SystemJS config in #1455 it might be a good idea to try that before opening an issue. There's no release yet though.

NgxDev commented 8 years ago

@filipesilva Oh, I'm so sad! I was so avoiding webpack :) Then again, I've got to hating webpack so so much simply because more and more examples out there were using it, going "against" the default (systemjs) approach of the cli, which is also the default approach in the angular docs/quickstart. Now I'm wondering if it will be a quick and painless transition, to move my cli app from systemjs to webpack, once the cli will move away from systemjs and towards webpack.

filipesilva commented 8 years ago

I've WIP instructions in https://github.com/angular/angular-cli/pull/1456. Most people seem to think the transition is easy.

lamaan commented 8 years ago

Hi,

I have now moved the code to the webpack version and am getting the following curious error from webpack trying to resolve a different dependency injection issue:

It seems that the Provider is not the correct type of provider?

https://github.com/lamaan/angular2-salah-times/tree/dictionary-with-injected-routes https://github.com/lamaan/angular2-salah-times/tree/dictionary-with-injected-routes

Lamaan

From: Filipe Silva [mailto:notifications@github.com] Sent: 29 July 2016 18:29 To: angular/angular-cli angular-cli@noreply.github.com Cc: lamaan lamaan@lamaan.com; State change state_change@noreply.github.com Subject: Re: [angular/angular-cli] ng build -prod fails to clean up files (#1068)

I've WIP instructions in #1456 https://github.com/angular/angular-cli/pull/1456 . Most people seem to think the transition is easy.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1068#issuecomment-236211922 , or mute the thread https://github.com/notifications/unsubscribe-auth/AFcXknye6JGMmFwaPg4Nn9Z3zwYmpKf3ks5qahxQgaJpZM4IzxAR . https://github.com/notifications/beacon/AFcXkhKtWQNTYaQ_PJR9-PcrXfym41FQks5qahxQgaJpZM4IzxAR.gif

lamaan commented 8 years ago

Hi again,

I removed the dependency on angular2-google-maps to get it working.

Other problems found using web pack:

  1. Files are very big. It creates 5Mb main script file and 5 Mb map file. Which is very large for a small app like this.
  2. The source map cannot be parsed – at least by chrome which makes debugging only possible really with console.log.
  3. I cannot see how to include additional npm components as I did with system.js packages – so for now I have managed with using cdn. 

Please can you let me know if and when you have any solutions to these?

Lamaan

From: Lamaan Ball [mailto:lamaan@lamaan.com] Sent: 05 August 2016 07:39 To: 'angular/angular-cli' reply@reply.github.com Subject: RE: [angular/angular-cli] ng build -prod fails to clean up files (#1068)

Hi,

I have now moved the code to the webpack version and am getting the following curious error from webpack trying to resolve a different dependency injection issue:

It seems that the Provider is not the correct type of provider?

https://github.com/lamaan/angular2-salah-times/tree/dictionary-with-injected-routes https://github.com/lamaan/angular2-salah-times/tree/dictionary-with-injected-routes

Lamaan

From: Filipe Silva [mailto:notifications@github.com] Sent: 29 July 2016 18:29 To: angular/angular-cli <angular-cli@noreply.github.com mailto:angular-cli@noreply.github.com > Cc: lamaan <lamaan@lamaan.com mailto:lamaan@lamaan.com >; State change <state_change@noreply.github.com mailto:state_change@noreply.github.com > Subject: Re: [angular/angular-cli] ng build -prod fails to clean up files (#1068)

I've WIP instructions in #1456 https://github.com/angular/angular-cli/pull/1456 . Most people seem to think the transition is easy.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1068#issuecomment-236211922 , or mute the thread https://github.com/notifications/unsubscribe-auth/AFcXknye6JGMmFwaPg4Nn9Z3zwYmpKf3ks5qahxQgaJpZM4IzxAR . https://github.com/notifications/beacon/AFcXkhKtWQNTYaQ_PJR9-PcrXfym41FQks5qahxQgaJpZM4IzxAR.gif

filipesilva commented 8 years ago

@lamaan can you open a new issue for the issue you're still experiencing?

angular-automatic-lock-bot[bot] commented 5 years ago

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.