question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting build error unable to import provide from @angular/core RC6

See original GitHub issue

I created an app.config.ts file in which I create application config variables. For, this I import OpaqueToken and provide. It was working fine till RC5 but after updating to RC6 I am unable to import provide from @angular/core

import { OpaqueToken, provide } from '@angular/core';

export const APP_CONFIG = new OpaqueToken('config');

const dictionary = {
    apiUrl: 'dummy/api',
};

export const APPCONFIG_PROVIDERS = [
    provide(APP_CONFIG, { useValue: dictionary })
]

Build Error:

Severity Code Error TS2305 Module ‘“/node_modules/@angular/core/index”’ has no exported member ‘provide’.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
neilhemcommented, Sep 1, 2016

Looks like it was deprecated in RC.5 & fully removed in RC.6

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [...],
  providers: [
    appRoutingProviders,
    {provide: LOCALE_ID, useValue: 'en-GB'},
    {provide: APP_CONFIG, useValue: dictionary},
  ],
})
0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting a module not found error only when building for prod
Found the issue, the import in the app module for my custom error handler was missing the braces... import CustomErrorHandler from '.
Read more >
Providing dependencies in modules - Angular
A provider is an instruction to the Dependency Injection system on how to obtain a value for a dependency. Most of the time,...
Read more >
Upgrading from AngularJS to Angular
Correspondingly, when you upgrade an AngularJS component and use it from Angular, all the bindings defined for scope (or bindToController ) of the...
Read more >
NG0201: No provider for {token} found! - Angular
To fix the error ensure that your service is registered in the list of providers of an NgModule or has the @Injectable decorator...
Read more >
48 answers on StackOverflow to the most popular Angular ...
Angular EXCEPTION: No provider for Http; Can't bind to 'formGroup' since it ... Importing lodash into angular2 + typescript application ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found