最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Cannot find module '@agmcore' - Stack Overflow

programmeradmin3浏览0评论

I am trying to use Google maps in my angular 4 app.
I am using Angular 4 and Nodejs 8.

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ApplicationRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './appponent';

import { AgmCoreModule } from '@agm/core';

@NgModule({
  imports: [
    BrowserModule,
    CommonModule,
    FormsModule,
    AgmCoreModule.forRoot({
      apiKey: 'GOOGLEAPIKEY'
    })
  ],
  providers: [],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule {}

Please help me ??

I am trying to use Google maps in my angular 4 app.
I am using Angular 4 and Nodejs 8.

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, ApplicationRef } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';

import { AgmCoreModule } from '@agm/core';

@NgModule({
  imports: [
    BrowserModule,
    CommonModule,
    FormsModule,
    AgmCoreModule.forRoot({
      apiKey: 'GOOGLEAPIKEY'
    })
  ],
  providers: [],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule {}

Please help me ??

Share Improve this question edited Nov 14, 2018 at 4:28 Vishal Biradar asked Jul 13, 2017 at 13:12 Vishal BiradarVishal Biradar 1,2292 gold badges12 silver badges25 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 16

npm install @agm/core --save

This command solved my problem.Thanks a lot.

Had the same issue.. Just run :

npm uninstall @agm/core -s
npm install @agm/core -s

It cannot find the module because you forgot to add it in your NgModule in imports :P :

  imports: [
    BrowserModule
    AgmCoreModule.forRoot({
      apiKey: 'GOOGLEAPIKEY'
    })
  ],

Best regards ;)

发布评论

评论列表(0)

  1. 暂无评论