Atom wrongfully throws error on missing angular packages


#1

I’m developing angular 4 with Typescript, and I can see that sometimes atom throws a “missing module” error without a reason. For example, I just installed CookieService and saved it to package.json, and then when I import it:

import { CookieService } from 'ngx-cookie-service';

Atom says: cannot find module ngx-cookie-service. The app, however, gets compiled and runs without any errors! A similar issue sometimes happens (and sometimes not) when importing items from @angular/core. Is there a way to fix it?

Thanks.


#2

I’m sure that Atom isn’t sending you these messages because the core functionality doesn’t include any awareness of frameworks. Instead, a package you have installed is sending you messages. The first step to finding the solution is to figure out which package this is. Do you know?


#3

I don’t quite understand what you mean, sorry. In the above example, the package is ngx-cookie-service, although as I mentioned, the app gets compiled and runs.


#4

One of the packages you have installed in Atom knows how to read Angular files. That package is sending you messages.


#5

These are the packages I have installed:

  • angular2-typeScript-snippets
  • atom-ide-ui
  • atom-typescript
  • ide-typescript
  • turbo-javascript

#6

And how is the message appearing?


#7

Simply, for example when importing items in one of my components:

import { Component, OnInit } from '@angular/core';

Module ‘“D:/MyProject/node_modules/@angular/core/core”’ has no exported member ‘Component’.

When I disable the atom-ide-ui package, these errors no longer appear, but other errors that are supposed to be there no longer appear also, because this package is essential for atom-typescript. Any suggestions?


#8

You could raise an issue on the relevant repository. Note that atom-ide-ui is only a package that shows the errors, and is unlikely to be the one throwing them. ide-typescript looks like a provider for it though, so I would start looking there.


#9

Your description provides no spatial information at all, or any clues that would indicate to me where in the editor these messages are popping up.


#10

The “Component” text gets a red line under it, and when you hover above it, atom opens a popup right under the cursor, and displays the message I mentioned above.