Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no imports can be found with watchman #21

Open
TitanNano opened this issue Aug 15, 2017 · 12 comments
Open

no imports can be found with watchman #21

TitanNano opened this issue Aug 15, 2017 · 12 comments

Comments

@TitanNano
Copy link

When ever I install watchman no imports are found. As soon as I uninstall it the imports are found again.

This works for small projects but not for some of the bigger ones. I simply installed watchman, as far as I can tell there is no further configuration required by import-js.

@trotzig
Copy link
Contributor

trotzig commented Aug 15, 2017

Interesting. Could you

  1. change the logLevel to "debug" in your config
  2. clear the cache by running rm $(importjs cachepath) from your project's root folder (you might have to npm install -g importjs before this since the atom extension has the lib bundled).
  3. then restart atom (or the extension itself, not sure how that works though).
  4. look at the logfile cat $(importjs logpath)

@TitanNano
Copy link
Author

@trotzig so, the log file from importjs logpath does not exist, but I get an error in the atom error console.

Watchman:  watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= �[31mERROR�[0m: Unknown option --no-pretty

after this error import-js falls back to resolve the import without watchman, this didn't happen before, but I can't tell what changed.

@trotzig
Copy link
Contributor

trotzig commented Aug 16, 2017

I think the "fallback" behavior you're seeing is because the cache has been filled once (without watchman). I bet it stays stale though, if you add more modules they won't show up when importing.

What version of watchman are you using? An upgrade might help, as suggested by this related thread.

@TitanNano
Copy link
Author

yes, you are right, I now installed the latest version.

Importjs log file still doesn't exist:

cat: /var/folders/cj/3v9zc0z95s9gz2865w28qs180000gn/T/importjs.log: No such file or directory

I now don't get any errors in atoms console and the behavior is as before.

I think the "fallback" behavior you're seeing is because the cache has been filled once (without watchman).
I deleted all cache DBs but after the fallback behavior occurred a new DB is created.

Also, I think it's definitely some kind of fallback because after the lookup with watchman failed, my breakpoint in the fb-watchman node module is not hit anymore.

@trotzig
Copy link
Contributor

trotzig commented Aug 16, 2017

Hrm, that's annoying.

The cache file being recreated is by design. import-js will try to recreate this file as soon as it can (whenever you try importing something).

I'm a little bit surprised that the log file isn't there. I wonder if atom is somehow overriding the default tmp folder for the system? Though it should be right there next to the cache files. If I remember correctly, even if you use the default log level it will post a few lines on startup.

@TitanNano
Copy link
Author

when I run importjs fix <file path> I get a result back. But importjs cachepath gives me this path
/var/folders/cj/3v9zc0z95s9gz2865w28qs180000gn/T/import-js-215cee2763d25a940fc5194c3fdd142f.db
while the actual db is at:
/var/folders/cj/3v9zc0z95s9gz2865w28qs180000gn/T/import-js-683f13e9b2c620cffc97cf16e2004f76.db

there is still no log file.

@trotzig
Copy link
Contributor

trotzig commented Aug 16, 2017

The cache location difference might be a version mismatch thing. What does importjs --version tell you?

@TitanNano
Copy link
Author

importjs --version
2.7.0

@trotzig
Copy link
Contributor

trotzig commented Aug 16, 2017

That's the latest, and assuming atom is configured to auto-update you should be on the same version through the extension (import-js is bundled with the atom extension).

Are you running the importjs fix command on the same file? The cache file will be unique to any project root (defined as a place where there is a package.json file).

@TitanNano
Copy link
Author

yes I'm up to date with atom-import-js and yes I ran importjs fix on the same file, same package.json.

@macrozone
Copy link

macrozone commented Aug 18, 2017

@trotzig importjs also is broken on some projects for me. I don't know why it suddenly broke.

Also be careful: npm install -g importjs does not install this imports, but another one: https://www.npmjs.com/package/importjs

the right name is: npm install -g import-js. Pretty confusing ;-)

@TitanNano
Copy link
Author

@macrozone yes I made the same mistake before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants