angular2-yandex-maps icon indicating copy to clipboard operation
angular2-yandex-maps copied to clipboard

Ошибка при подключении модуля на angular/common 4.0.1

Open flashart92 opened this issue 7 years ago • 15 comments

При импортировании модуля "YaCoreModule.forRoot()" появляется ошибка. Скрин package.json http://joxi.ru/nAyYvLgS1RVjAZ image Скрин модуля, в которые требуется провести импорт http://joxi.ru/E2peEWxHZ0beAY image Трейс ошибки: "Uncaught (in promise): Error: Unexpected value '[object Object]' imported by the module 'DepositModule'. Please add a @NgModule annotation. Error: Unexpected value '[object Object]' imported by the module 'DepositModule'. Please add a @NgModule annotation. at Error.ZoneAwareError (http://localhost:8080/web-polyfills.js:7863:33) at ZoneAwareError (http://localhost:8080/web-polyfills.js:7860:35) at syntaxError (http://localhost:8080/web-common.js:6532:34) at http://localhost:8080/web-common.js:18999:44 at Array.forEach (native) at CompileMetadataResolver../node_modules/@angular/compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (http://localhost:8080/web-common.js:18982:49) at JitCompiler../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler._loadModules (http://localhost:8080/web-common.js:30107:64) at JitCompiler../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (http://localhost:8080/web-common.js:30066:52) at JitCompiler../node_modules/@angular/compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (http://localhost:8080/web-common.js:30028:21) at ModuleBoundCompiler../node_modules/@angular/compiler/@angular/compiler.es5.js.ModuleBoundCompiler.compileModuleAsync (http://localhost:8080/web-common.js:30396:31) at MergeMapSubscriber.project (http://localhost:8080/web-common.js:58659:140) at MergeMapSubscriber../node_modules/rxjs/operator/mergeMap.js.MergeMapSubscriber._tryNext (http://localhost:8080/web-common.js:92008:27) at MergeMapSubscriber../node_modules/rxjs/operator/mergeMap.js.MergeMapSubscriber._next (http://localhost:8080/web-common.js:91998:18) at MergeMapSubscriber../node_modules/rxjs/Subscriber.js.Subscriber.next (http://localhost:8080/web-common.js:88818:18) at http://localhost:8080/web-common.js:90365:36 at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:8080/web-polyfills.js:7235:26) at Object.onInvoke (http://localhost:8080/web-common.js:35220:37) at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:8080/web-polyfills.js:7234:32) at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.run (http://localhost:8080/web-polyfills.js:7031:43) at http://localhost:8080/web-polyfills.js:7584:57 at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:8080/web-polyfills.js:7268:31) at Object.onInvokeTask (http://localhost:8080/web-common.js:35211:37) at ZoneDelegate.webpackJsonp../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:8080/web-polyfills.js:7267:36) at Zone.webpackJsonp../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:8080/web-polyfills.js:7071:47) at drainMicroTaskQueue (http://localhost:8080/web-polyfills.js:7434:35)"

flashart92 avatar Apr 12 '17 06:04 flashart92

возможно дурацкий совет, но попробуйте YaCoreModule.forRoot() последним поставить в импорте

Gorniv avatar Apr 12 '17 09:04 Gorniv

или YaCoreModule.forRoot(routing)

Gorniv avatar Apr 12 '17 09:04 Gorniv

Собрал из стартера webpack и на планкере https://plnkr.co/edit/PbRPJHlNvh73EZRyqHTt?p=preview, работает. Возможно еще в чем-то причины.

AnteaterKit avatar Apr 13 '17 10:04 AnteaterKit

Та же проблема, пробовал изменять порядок загрузки модулей и добавлять раути как аргумент.

"@angular/[email protected]": version "4.0.0" resolved "https://registry.yarnpkg.com/@angular/common/-/common-4.0.0.tgz#ca18983222fdab4ecaa7a8b99eda6ff661e6dc92"

dmytrokostiushko avatar May 05 '17 12:05 dmytrokostiushko

Столкнулся точно с такой же проблемой, собирал проект с помощью angular-cli, под angular4.

UnEpicFail avatar May 15 '17 09:05 UnEpicFail

Я в итоге решил проблему тем, что выкачал с гитхаба исходники и проект нормально собрался и запустился с помощью веб пака.

flashart92 avatar May 16 '17 04:05 flashart92

Спасибо за идею.

UnEpicFail avatar May 16 '17 08:05 UnEpicFail

Кто-нибудь нашел решение проблемы?

vaydich avatar Jul 04 '17 14:07 vaydich

@UnEpicFail Такая же беда. Не собираеться проект с помощью angular-cli, под angular4.

import { YaCoreModule } from "angular2-yandex-maps";

При сборке ругаеться.

Варианты двигать вверх вниз в импорте не помогли YaCoreModule.forRoot() YaCoreModule.forRoot(routing)

Какие еще варианты будут?

P.S. node: 8.1.3 os: win32 x64 "angular/cli": 1.2.0 "angular/common": 4.2.5 "angular/compiler": 4.2.5 "angular/core": 4.2.5 "angular/forms": 4.2.5 "angular/http": 4.2.5 "angular/platform-browser": 4.2.5 "angular/platform-browser-dynamic": 4.2.5 "angular/router": 4.2.5 "angular/compiler-cli": 4.2.5 Typescript 2.4.1

BGXi avatar Jul 05 '17 13:07 BGXi

@BGXi да ну нафиг) Так тоже норм

	private setYaMapScript(): void {
		const map = this.render.createElement('script');
		map.type = 'text/javascript';
		map.src = `//api-maps.yandex.ru/2.1/?lang=ru_RU`;
		map.onload = () => { /* logic */ };

		this.render.appendChild(this.el.nativeElement, map);
	}

Dok11 avatar Aug 03 '17 15:08 Dok11

Это из-за того,что NgModule из одного node_modules не равен NgModule из другого node_modules, даже если это одна и та же версия. Отредактируйте файл /src/tsconfig.app.json, добавив пути "baseUrl": "", "paths": { "@angular/": [ "../node_modules/@angular/" ] }, чтобы все ссылались в одно и тоже место и всё заработает. Можно еще через npm link как-то это сделать, но чето я не стал разбираться, и так норм.

Если че, в строке "@angular/ "после слэша звёздочка, в обоих местах, чето при добавлении поста она не отобразилась

Belouccio avatar Aug 21 '17 15:08 Belouccio

image Что-то мне не помогает image

sergamers avatar Sep 18 '17 10:09 sergamers

Проект похоже не поддерживается, да?

fedorinoGore avatar Oct 02 '17 15:10 fedorinoGore

@flashart92 Подскажи выкачал исходники и? Я попробовал разместить \src в папке проекта, но ошибка все та же...

fedorinoGore avatar Oct 02 '17 15:10 fedorinoGore

сделали фикс, пробуйте с новой версией.

Gorniv avatar Oct 03 '17 05:10 Gorniv