"No provider for TranslateService" error somehow connected to npm install
As documented on ngx-translate's github:
You have to import TranslateModule.forRoot() in the root NgModule of your application.
app.module.ts:
@NgModule({
imports: [
//...
TranslateModule.forRoot(),
],
//...
})
Or if you're using a SharedModule
:
If you use a SharedModule that you import in multiple other feature modules, you can export the TranslateModule to make sure you don't have to import it in every module
@NgModule({
exports: [
//...
TranslateModule,
],
//...
})
I'm not 100% sure what did it, but I deleted yarn.lock, corrected a node version discrepancy, renewed node_modules
and it seems to be fixed now. My pom.xml
had node 6.11.0 but I had been using 6.10.3 to install packages and run things.
UPDATE: Scratch that. The problem is back again. It started after changing a source file under node_modules/. It remained after reversing the change... after deleting yarn.lock... after deleting target/... after completely reinstalling all node modules... after checking out the master branch. Finally, after all that AND reinstalling all of the node modules, it works again.
I don't know what is going on.