damienbod / AngularWebpackVisualStudio

Template for ASP.NET Core, Angular with Webpack and Visual Studio
https://damienbod.com/2016/06/12/asp-net-core-angular2-with-webpack-and-visual-studio/
MIT License
487 stars 128 forks source link

Could not find a declaration file for module AppModuleNgFactory #149

Open programulya opened 6 years ago

programulya commented 6 years ago

Hi all,

After updating to Angular 6 I have an error with exporting AppModuleNgFactory in main-aot.ts while running build-production:

ERROR in [at-loader] ./angularApp/main-aot.ts:7:36 TS7016: Could not find a declaration file for module './app/app.module.ngfactory'. 'D:/.. app.module.ngfactory.js' implicitly has an 'any' type. Child html-webpack-plugin for "index.html": [0] ./~/html-webpack-plugin/lib/loader.js!./angularApp/index.html 627 bytes {0} [built] npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! delivery@1.0.0 webpack-production: set NODE_ENV=production && webpack npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the delivery@1.0.0 webpack-production 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: ... error Command failed with exit code 2.

My main-aot.ts:

declare var System: any;

import { platformBrowser } from '@angular/platform-browser';
import { enableProdMode } from '@angular/core';
import { AppModuleNgFactory } from './app/app.module.ngfactory';

enableProdMode();

platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);

What do you think what fix could be applied here? Thanks.

damienbod commented 6 years ago

Have you installed the npm packages?

cmd:

npm install npm run build-production

Greetings Damien

programulya commented 6 years ago

Hi Damien,

I use yarn and I installed the next packages (using yarn install): "dependencies": { "@angular/animations": "6.0.7", "@angular/cdk": "^6.3.2", "@angular/cli": "^6.0.8", "@angular/common": "6.0.7", "@angular/compiler": "6.0.7", "@angular/compiler-cli": "6.0.7", "@angular/core": "6.0.7", "@angular/forms": "6.0.7", "@angular/http": "6.0.7", "@angular/material": "6.3.2", "@angular/platform-browser": "6.0.7", "@angular/platform-browser-dynamic": "6.0.7", "@angular/platform-server": "6.0.7", "@angular/router": "6.0.7", "@angular/upgrade": "6.0.7", "@ng-bootstrap/ng-bootstrap": "^2.2.0", "@types/file-saver": "^0.0.1", "angular-in-memory-web-api": "^0.6.0", "bootstrap": "^4.1.1", "core-js": "2.4.1", "file-saver": "^1.3.3", "font-awesome": "^4.7.0", "hammerjs": "^2.0.8", "ie-shim": "~0.1.0", "ngx-cookie-service": "^1.0.10", "ngx-toastr": "^8.8.0", "popper.js": "^1.14.3", "reflect-metadata": "0.1.9", "rxjs": "6.2.1", "rxjs-compat": "6.2.1", "tether": "^1.4.0", "zone.js": "0.8.26" }, "cacheDirectories": [ "node_modules" ], "devDependencies": { "@types/node": "7.0.8", "angular-router-loader": "^0.6.0", "angular2-template-loader": "^0.6.2", "awesome-typescript-loader": "3.1.2", "clean-webpack-plugin": "^0.1.15", "concurrently": "^3.4.0", "copy-webpack-plugin": "^4.0.1", "css-loader": "^0.27.1", "file-loader": "^0.10.1", "html-webpack-plugin": "^2.28.0", "jquery": "^3.1.1", "json-loader": "^0.5.4", "ngc-webpack": "^4.1.2", "node-sass": "^4.9.0", "raw-loader": "^0.5.1", "rimraf": "^2.6.1", "sass-loader": "^7.0.3", "source-map-loader": "^0.2.0", "style-loader": "^0.13.2", "ts-helpers": "^1.1.2", "tslint": "^4.5.1", "tslint-loader": "^3.4.3", "typescript": "2.7.2", "url-loader": "^0.5.8", "webpack": "^2.2.1", "webpack-dev-server": "2.4.1" },

Thanks, Julia

programulya commented 6 years ago

Sorry, issue closed by my mistake :( I mean, it's still opened

programulya commented 6 years ago

Hi guys, any other suggestions?

Thanks, Julia

FabianGosebrink commented 6 years ago

I really can not reproduce this :( Hmm... did you make changes to the repo?

In the meantime it was updated to 6.1.0 - Do you still have the issues?

For me npm install && npm run build-production is doing great.

Cheers

greatsayan commented 5 years ago

Hi guys!

I run npm install && npm run build-production but when I'm trying to build the solution I have the same issue in visual studio... Any ideas?

Thanks.