Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

ng build --prod not working #2605


User avatar
0
walkerscott created

I'm moved to the root directory and running the ng build --prod command but its not working. it says "you have to be inside an angular-cli project in order to use the build command." What should I do to fix it? I went through some post here and on other websites all I found is to uninstall angular-cli and install the updated version. But our aspnet zero v3.1 doesn't support updated version of angular cli.

Another solution I went through was updation of angular-cli.json file which is also not working because if go that way our application starts behaving abnormally like redirects after login stops working.

there is another problem with updation angular-cli module is dependency with other modules.

I need to deploy application to present it to client. Need help asap. Thanks.


11 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We have upgraded to lates angular-cli recently. You can apply changes in this issue to make it working <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/77">https://github.com/aspnetzero/aspnet-ze ... /issues/77</a>. If it does not work for you, please send your project to us via email (just a note, remove node_modules folder before sending) and we will fix it.

    Thanks.

  • User Avatar
    0
    walkerscott created

    HI Ismail, "npm install" command was causing trouble as per getting started documentation you guys referred "yarn install" . So I need to know whether you guys have fixed this thing? can we use "npm install" too or "yarn install" is still strongly recommended? Thanks

  • User Avatar
    0
    walkerscott created

    I have updated my package.json, angular-cli.json , karma.config now I'm getting this error <a class="postlink" href="https://drive.google.com/file/d/0B30VFzGA7ywhT1k1WHpzRS1xSTA/view?usp=sharing">https://drive.google.com/file/d/0B30VFz ... sp=sharing</a>

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    We still suggest "yarn install" at the moment but we will work on npm install in a few days. Did you get this error on "npm start" ? If so, can you try "ng serve" ? It gives more detailed exception messages. If it does not work for you, please send your project to us and we will fix it.

    Thanks.

  • User Avatar
    0
    walkerscott created

    Still getting same message ng serve You must be inside an angular-cli project in order to use the serve command same for ng build

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Please send your project to us (<a href="mailto:[email protected]">[email protected]</a>) and we will fix it for you. Don't forget to remove node_modules and dist folder before sending it.

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I have investigated your project which you have sent and it seems like the problems are caused because of the module you have created. The WorkhumAppModule has some problems. I have followed below steps to fix it.

    1. First I have installed npm dependencies using "yarn install" (Install yarn if you haven't already here <a class="postlink" href="https://yarnpkg.com/">https://yarnpkg.com/</a>)
    2. Remove require from template definitions: For example in BreadCrumbsComponent component
    template: require('./breadcrumb.component.html')
    

    needs to be changed to

    template: './breadcrumb.component.html'
    

    . Same thing is valid for style definitions. There is one in the project but I don't remmeber now. 3. Import below 3 component to WorkhumAppModule

    import { CounterComponent } from 'workhum/counter/counter.component';
    import { HomeComponent } from 'workhum/home/home.component';
    import { FetchDataComponent } from 'workhum/fetchdata/fetchdata.component';
    

    and add them to declarations as well

    declarations: [
            WorkhumAppComponent,
            NavMenuComponent,
            UserProfileComponent,
            UserProfileAccountComponent,
            Error404Component,
            FooterComponent,
            BreadCrumbsComponent,
            DefaultSettingComponent,
            
            CounterComponent,
            HomeComponent,
            FetchDataComponent
        ]
    
  • User Avatar
    0
    walkerscott created

    It was and is still working fine with "npm run hmr"/"npm start" "ng build" is still not working even after making these changes. ng build and serve both still telling the same.

    I now have merged both solutions for single publish.

  • User Avatar
    0
    walkerscott created

    looking forward

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I will send you the fixed project via email, can you first try with that ? First let's make it working seperately, then you can merge solutions.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It seems like there was a few problems. First global angular-cli and local angular-cli versions was different, we removed global angular-cli and installed the latest version.

    Second, Typecript 2.1 for VS was missing, we installed it and project was building successfully both in angular-cli and Visual Studio.

    I hope this helps anyone else having same problem.