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

Uncaught Error: Unexpected value 'DropdownModule' imported by the module 'AppModule'. Please add a @NgModule annotation. #32

Open
hpdrago opened this issue Sep 17, 2017 · 8 comments

Comments

@hpdrago
Copy link

hpdrago commented Sep 17, 2017

Hi, I just started to use this library and now I am getting the following:

vendor.bundle.js:88386 Uncaught Error: Unexpected value 'DropdownModule' imported by the module 'AppModule'. Please add a @NgModule annotation.

The DropdownModule is from PrimeNG but that doesn't have anything to do why I am getting this error. If I remove json-typescript-mapper from my application everything works again.

Thanks for any help!

Here's my tsconfig.json

{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"paths": {
"@angular/": [
"../node_modules/@angular/
"
]
},
"typeRoots": [
"../node_modules/@types"
]
}
}

Here's my package.json

{
"name": "my-stock-tickers-ui",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint "src/**/*.ts"",
"test": "ng test",
"pree2e": "webdriver-manager update`",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.4.1",
"@angular/cli": "^1.0.0-beta.28.3",
"@angular/common": "~4.4.1",
"@angular/compiler": "~4.4.1",
"@angular/compiler-cli": "~4.4.1",
"@angular/core": "~4.4.1",
"@angular/forms": "~4.4.1",
"@angular/http": "~4.4.1",
"@angular/platform-browser": "~4.4.1",
"@angular/platform-browser-dynamic": "^4.4.1",
"@angular/platform-server": "~4.4.1",
"@angular/router": "~4.4.1",
"@angular/upgrade": "~4.4.1",
"@types/lodash": "^4.14.57",
"@types/quill": "^1.3.2",
"angular-in-memory-web-api": "~0.3.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"json-typescript-mapper": "^1.1.3",
"ng2-toastr": "^4.0.1",
"primeng": "^4.2.0-rc.1",
"quill": "^1.3.2",
"reflect-metadata": "^0.1.10",
"retyped-http-status-codes-tsd-ambient": "^1.0.5-0",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"tether": "^1.4.0",
"ts-helpers": "^1.1.2",
"tslint": "^5.2.0",
"webpack": "^3.4.1",
"zone.js": "^0.8.10"
},
"devDependencies": {
"@angular/cli": "^1.3.2",
"@types/jasmine": "^2.5.47",
"@types/lodash": "^4.16.4",
"@types/node": "^7.0.16",
"codelyzer": "^3.0.1",
"css-loader": "^0.28.7",
"gulp": "^3.9.1",
"jasmine-core": "^2.6.1",
"jasmine-spec-reporter": "^4.1.0",
"karma": "^1.6.0",
"karma-chrome-launcher": "^2.1.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-remap-istanbul": "^0.6.0",
"protractor": "^5.1.1",
"style-loader": "^0.18.2",
"ts-node": "^3.0.3",
"tslint": "^5.2.0",
"typescript": "2.2.1",
"webpack": "^3.4.1",
"webpack-dev-server": "^2.4.5"
}
}

@jf3096
Copy link
Owner

jf3096 commented Sep 18, 2017

try to install another similar decorator and see if you encounter the same error

@hpdrago
Copy link
Author

hpdrago commented Sep 18, 2017

Hi jf3096,
Sure, I would be glad, do you have a suggestion of another decorator?
Thanks,
Mike.

@jf3096
Copy link
Owner

jf3096 commented Sep 20, 2017

https://github.com/pleerock/class-validator. good luck!

@sixsixtrample
Copy link

@hpdrago did you ever get this resolved? I'm facing the same issue right now.

@hpdrago
Copy link
Author

hpdrago commented Nov 8, 2017

No, I just changed the name of my properties so they matched. I would have loved to use this package but didn't want the hassle of trying to figure out the issue. If you figure it out, let me know.

@sixsixtrample
Copy link

sixsixtrample commented Nov 8, 2017 via email

@owennewo
Copy link

I saw a similar error when using angular 5. The error message is quite misleading. In my case I had created a custom angular5 module (usng ng cli) that was trying to use json-typescript-mapper. The problem went away when I used json-typescript-mapper not from a custom module (e.g. from app.component.ts). Perhaps I got lucky and essentially accidently did what @sixsixtrample suggested.

@kirtixs
Copy link

kirtixs commented Nov 20, 2017

please see #2 , specifically #2 (comment) this resolves all issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants