Angular 5 :ERROR in No NgModule metadata found for 'AppModule' - javascript

I am trying to build my angular5 application but got the following error
on ng build.
I've tried the solution from this fix https://github.com/angular/angular-cli/issues/8798
npm cache clean --force
npm install
npm install --save-dev #angular/cli#latest
But still, I am getting the error
ERROR in No NgModule metadata found for 'AppModule'.
Versions
Angular CLI: 6.2.3
Node: 9.9.0
OS: linux x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
---------------------------------------------------------
#angular-devkit/architect 0.7.5
#angular-devkit/build-angular 0.7.5
#angular-devkit/build-webpack 0.7.5
#angular-devkit/core 0.8.3
#angular-devkit/schematics 0.8.3
#angular/cli 6.2.3
#schematics/angular 0.8.3
#schematics/update 0.8.3
rxjs 5.5.7
typescript 2.5.3
webpack 4.19.1
UPDATE
main.ts
import { enableProdMode } from '#angular/core';
import { platformBrowserDynamic } from '#angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));

Related

Why can't I generate an Angular component?

I started a project back in August, I was able to create components just fine. But, now when I try to generate an Angular component I receive this error
Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'kind' of undefined
I'm using Angular 10 and NativeScript 7
Angular CLI: 10.1.7
Node: 10.22.0
OS: darwin x64
Angular: 10.1.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
#angular-devkit/architect 0.1001.7
#angular-devkit/build-angular 0.1001.7
#angular-devkit/core 10.1.7
#angular-devkit/schematics 10.1.7
#angular/cdk 10.2.5
#angular/cli 10.1.7
#angular/material 10.2.5
#schematics/angular 10.1.7
#schematics/update 0.1001.7
rxjs 6.6.3
typescript 3.9.7

Initializing angular project fails

I am trying to set up angular project from scratch.
Below are the steps followed
Installed Node js
Installed Angular CLI using npm install -g #angular/cli#latest
Versions
Angular CLI: 9.1.4
Node: 12.16.3
OS: win32 x64
Angular:
...
Ivy Workspace:
Package Version
#angular-devkit/architect 0.901.4
#angular-devkit/core 9.1.4
#angular-devkit/schematics 9.1.4
#schematics/angular 9.1.4
#schematics/update 0.901.4
rxjs 6.5.4
Created a new app using ng new app_name
While trying to run the app through command ng serve I am getting a host of errors and app is not starting up
Have attached screen shot of the error
edit
If you use angular 9.1.6 it should be fine now
npm update #angular/cli #angular/core
original post
I had the same problem after making a fresh project using
npm install -g #angular/cli
ng new <projectname>
I believe its a bug in 9.1.5 Angular when using the 9.1.4 cli
You'll see the issue when you do
ng --version
if you get:
Angular CLI: 9.1.4
Node: 12.16.3
OS: win32 x64
Angular: 9.1.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
To resolve you install 9.1.4 Angular instead by running after you've done your
ng new <projectname>
then run
npm install #angular/core#9.1.4 #angular/animations#9.1.4 #angular/common#9.1.4 #angular/forms#9.1.4 #angular/platform-browser#9.1.4 #angular/router#9.1.4 #angular/platform-browser-dynamic#9.1.4 #angular/compiler#9.1.4 #angular/compiler-cli#9.1.4 #angular/language-service#9.1.4
ng build
See my other answer for reference
ERROR in TypeError: Cannot read property 'flags' of undefined

Why is angular fire saying I'm not logged in even though firebase tools says I am?

I'm having an issue with my ng add #angular/fire command and I think this might have something to do with it. below is a screenshot of me checking my login by running firebase login, it clearly says I'm logged in. then I run a deploy to firebase command and it says "🚨 You're not logged into Firebase. Logging you in..."
Date: 2020-01-12T23:18:12.366Z - Hash: 0398eefc1b5a238b8b7e - Time: 37932ms
🚀 Your application is now available at https://devinterface-78409.firebaseapp.com/
Raphaels-MacBook-Pro:devInterface raphael_castro$ firebase login
Already logged in as raphael#rcincorporated.net
Raphaels-MacBook-Pro:devInterface raphael_castro$ ng run devInterface:deploy
🚨 You're not logged into Firebase. Logging you in...
📦 Building "devInterface"
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
I've reinstalled npm, firebase, angular/fire, and angular to try and resolve this issue; no dice.
here is my angular versions:
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.803.20
#angular-devkit/build-angular 0.803.20
#angular-devkit/build-optimizer 0.803.20
#angular-devkit/build-webpack 0.803.20
#angular-devkit/core 8.3.20
#angular-devkit/schematics 8.3.20
#angular/cdk 8.2.3
#angular/cli 8.3.20
#angular/fire 5.2.3
#angular/material 8.2.3
#ngtools/webpack 8.3.20
#schematics/angular 8.3.20
#schematics/update 0.803.20
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2

Error: Internal error: unknown identifier

I want to publish my angular application for production, when i run
ng build --prod --aot = false
it builds successfully, but the main.js file is large(6 MB), same with vendor.js (10 mb), which make my application so slow. So i tried running with ng build --prod, but i get this error
ERROR in : Error: Internal error: unknown identifier [{"filePath":"C:/Users/myuser/Documents/anular-app/angularpp_test/Client/myweb/node_modules/#angular/core/core.d.ts","name":"ErrorHandler","members":[]}]
this is my configuration
Angular CLI: 6.0.7
Node: 8.9.4
OS: win32 x64
Angular: 5.2.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.6.7
#angular-devkit/build-angular 0.6.7
#angular-devkit/build-optimizer 0.6.7
#angular-devkit/core 0.3.1
#angular-devkit/schematics 0.6.7
#angular/cli 6.0.7
#angular/flex-layout 2.0.0-beta.10
#ngtools/webpack 6.0.7
#schematics/angular 0.6.7
#schematics/update 0.6.7
rxjs 5.5.2
typescript 2.4.2
webpack 4.8.3
Look in your app.modules, specifically where your provider. Must be using a
provide: [ErroHandler]
Remove this brackets.

npm: Add dependecy from existing dependency tree

I have a Vue app that uses vuetable-2 and vue-axios, with the following imports in app.js
import Vue from 'vue'
import VueMaterial from 'vue-material'
import axios from 'axios'
import VueAxios from 'vue-axios'
Without having axios directly in package.json's dependencies section, eslint will complain
[eslint] 'axios' should be listed in the project's dependencies.
I already have axios in ./node_modules as part of the vue-axios dependencies.
└─┬ vuetable-2#1.6.6
└── axios#0.15.3
Running npm install --save axios will fetch the latest version of axios and add it to package.json, but now I have 2 versions of axios in my dependencies
├── axios#0.17.0
└─┬ vuetable-2#1.6.6
└── axios#0.15.3
How can I re-use axios#0.15.3 that is part of the vuetable-2 dependency?
Don't forget about exact version
write in package.json without ^
or type npm i axios#0.15.3 -S -E
-E, --save-exact: Saved dependencies will be configured with an exact version rather than using npm's default semver range operator.
You can simply add it to the dependencies in package.json yourself:
"axios": "^0.15.3"
So for example your package.json might look like:
{
"dependencies": {
"vuetable-2": "^1.6.6",
"axios": "^0.15.3"
}
}
Although obviously you would have more dependencies etc.
Once that is done, just run
npm install
you can just install the same axios version which used in the vuetable-2, just run following code:
npm i axios#0.15.3 -S

Categories