AnteaterKit / angular2-yandex-maps

Angular 2 components Yandex Maps.
27 stars 23 forks source link

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

Open flashart92 opened 7 years ago

flashart92 commented 7 years ago

При импортировании модуля "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)"

Gorniv commented 7 years ago

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

Gorniv commented 7 years ago

или YaCoreModule.forRoot(routing)

AnteaterKit commented 7 years ago

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

dmytrokostiushko commented 7 years ago

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

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

UnEpicFail commented 7 years ago

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

flashart92 commented 7 years ago

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

UnEpicFail commented 7 years ago

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

vaydich commented 7 years ago

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

BGXi commented 7 years ago

@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

Dok11 commented 6 years ago

@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);
    }
Belouccio commented 6 years ago

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

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

sergamers commented 6 years ago

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

fedorinoGore commented 6 years ago

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

fedorinoGore commented 6 years ago

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

Gorniv commented 6 years ago

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