Comments (33)
I'm getting the exact same error. Using Sublime 3103 and import-js 1.1.0. The log file you mentioned checking (found at the path returned by importjsd logpath
) is empty.
{'command': 'fix', 'fileContent': '', 'pathToFile': None}
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 568, in run_
return self.run(edit, **args)
File "import-js in /Users/brandon/Library/Application Support/Sublime Text 3/Installed Packages/ImportJS.sublime-package", line 158, in run
BrokenPipeError: [Errno 32] Broken pipe
from sublime-import-js.
Everyone, thanks for helping out. I managed to reproduce the issue locally by trying to import inside an anonymous file (one that hasn't yet got a filename). I just submitted version 1.1.1 of the npm module, so all you need to do to is
npm install -g import-js
We should have caught this earlier. But neither me, @lencioni, or any other of the core members of import-js use the Sublime plugin on a daily basis. Without you folks reporting stuff like this, it would have never been caught. Thanks for making import-js better! 😍
from sublime-import-js.
@trotzig I'm still seeing the issue running 1.1.1 😖 . The file I've been testing with is saved to disk.
from sublime-import-js.
Awesome @pranjaltech, I'm glad you got it working!
from sublime-import-js.
What version of import-js do you have installed? You can find this out by running importjs --version
from the command line.
from sublime-import-js.
The version is 1.1.0
from sublime-import-js.
Could you run importjsd logpath
, then open the file returned by that
command? There might ve something interesting in there.
On Wednesday, 31 August 2016, LeonardoGentile [email protected]
wrote:
The version is 1.1.0
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjS5ewwyuDIMjJTyr352mYCQAn-amuLks5qlT2YgaJpZM4JwlPh
.
from sublime-import-js.
Cool, thanks for providing more context @bcaplan! Could you try running importjsd
from the command-line? I have a feeling this will break somehow. The sublime plugin is using this command to start a background process which it will interact with.
from sublime-import-js.
What version of the sublime plugin are you using? (e.g. 1.0.0 or 1.0.1)
from sublime-import-js.
@trotzig Happy to help!
Running importjsd
from the command line:
$ importjsd
ImportJS (v1.1.0) DAEMON active. Logs will go to: /var/folders/f0/1p1s_ydn2ms7jgbr0s13lst40000gn/T/importjs.log
Then it seems to wait until I interrupt.
@lencioni I'm using version 1.0.1 of the Sublime plugin.
from sublime-import-js.
Then it seems to wait until I interrupt.
Yeah, that's expected behavior.
Could you post the output from the Sublime console where it says "ImportJS loaded with environment:"? I wonder if this is a PATH issue. You can obfuscate any paths or settings you don't want to share publicly. It's possible that the PATH doesn't contain the folder where importjsd
is located.
from sublime-import-js.
As @bcaplan sais also my log file is empty.
My version of the plugin is 1.0.1 and importjs from npm is 1.1.0
I have another clue: the plugin sometimes works. Meaning that from time to time it works on some jsx file, then even in the same file it starts not to work logging the error described in the first post and then after that it won't work anymore for any file.
In any case it shouldn't be a path problem because sometimes it executes, it seems more a problem related to the file parsing, maybe some char in the file conflicts somehow with the plugin.
How sometimes it works/doesn't work seems not to be predictable, let me know if I can I do something more to track down this problem.
from sublime-import-js.
@trotzig It doesn't appear to be a PATH issue since I am able to resolve it in the Sublime console:
>>> print(os.popen("which importjsd").read())
/usr/local/bin/importjsd
I have a bit more info I discovered on the behavior. This might be what @LeonardoGentile was seeing as well with his intermittent success.
If I relaunch Sublime, I am able to get it to work with the word
command. And that command will continue to work after the first time. If at any point I try to use the fix
command, it will throw the following error the first time, then the broken pipe error reported above every time after that. Once this error has happened, the word
command ceases to work again until relaunching Sublime.
{'command': 'fix', 'pathToFile': '/Users/brandon/test/components/Test.jsx', 'fileContent': '\nReact.PropTypes.bool.isRequired'}
Traceback (most recent call last):
File "./json/scanner.py", line 30, in _scan_once
IndexError: string index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./json/decoder.py", line 368, in raw_decode
File "./json/scanner.py", line 32, in _scan_once
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 568, in run_
return self.run(edit, **args)
File "/Users/brandon/Library/Application Support/Sublime Text 3/Packages/ImportJS/import-js.py", line 162, in run
result = json.loads(resultJson)
File "./json/__init__.py", line 319, in loads
File "./json/decoder.py", line 352, in decode
File "./json/decoder.py", line 370, in raw_decode
ValueError: No JSON object could be decoded
from sublime-import-js.
I'm going to close this with the assumption that 1.1.1 fixes the issue. If you still get the error, please reopen!
from sublime-import-js.
@trotzig Thanks for all your help on this, it's a really great utility!
I just noticed (and corrected) a typo above in which I stated I was getting an error with the import
command. There is no such command, it was the fix
command I was having an issue with.
from sublime-import-js.
That's too bad... 😢
Did you restart Sublime after upgrading?
from sublime-import-js.
(not that I really think that's going to help)
from sublime-import-js.
@trotzig This might actually be caused by an odd conflict with ESLint. I tried running the fix
command from importjs
on the command line and it threw an error in there complaining about my .eslintrc
. I'm not sure why it was executing ESLint or why I hadn't run into this error when actually linting 😛.
Commenting out the offending line in my .eslintrc
fixed it!
For posterity, I had the eslint-config-airbnb-base
module installed and the following in my .eslintrc
:
{
"extends": [
"airbnb"
]
}
from sublime-import-js.
That's interesting. It uses eslint under the hood to find all undefined variables (and unused imports too). We should handle this better though, so I filed an issue over at the main project to track: Galooshi/import-js#348
from sublime-import-js.
Ah, that makes sense. Thanks again for the help!
from sublime-import-js.
When you eslint your project, do you rely on a globally installed eslint + plugins or do you use local ones in the node_modules
folder? Import-js uses the latter.
from sublime-import-js.
I'm closing this once more. Thanks for your patience.
from sublime-import-js.
We have it installed locally with that plugin in node_modules
.
from sublime-import-js.
@bcaplan if you have eslint-config-airbnb-base installed, I believe you need to extend airbnb-base
, not airbnb
.
{
"extends": [
"airbnb-base"
]
}
from sublime-import-js.
@lencioni It seems to work either way. Here's the error it has in case anyone is curious:
Error: /Users/brandon/test/node_modules/eslint-config-airbnb-base/rules/style.js:
Configuration for rule "indent" is invalid:
Value "data["1"].outerIIFEBody" has additional properties.
from sublime-import-js.
According to eslint/eslint#6655 this can happen if running something that uses ESLint 2.x (which is the version bundled with import-js). I hopped into my local import-js module folder and upgraded ESLint to 3.x. It fixed the issue with the airbnb plugin.
I guess the problem is that it's able to us an .eslintrc
outside the scope of its own module which opens it up to conflicts like this, especially if there's a version disparity.
from sublime-import-js.
Unlike @bcaplan I don't have a locally installed eslint, mine is global and its version is v3.1.1
I've cd into the gloabal installation of importjs and I've also noticed that it's using eslint [email protected]
.
So maybe this version mismatch could be the cause
from sublime-import-js.
This version mismatch is unfortunate, and the dependency between the locally installed eslint and the eslint used by import-js needs to be cut or improved in some way.
We use the local eslint configuration for two reasons:
- to prevent trying to import global variables (e.g. jQuery, jasmine)
- to support the specific javascript flavor that the local project uses (e.g. React)
We could introduce a globals
configuration to import-js to avoid having to inherit from eslint config. And maybe we can try to cover as many flavors as possible for the internal eslinting done by import-js? If we add support for enough stuff, we wouldn't have to use local config.
Let's continue the discussion over at the main project since this isn't really sublime-specific: Galooshi/import-js#348
from sublime-import-js.
globals
in import-js config isn't great, because they might be specific to any particular file (as defined by globals
comments or .eslintrc files in sub-directories).
from sublime-import-js.
I am facing the same error while using import-js
, haven't been able to find a fix.
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 812, in run_
return self.run(edit, **args)
File "import-js in /Users/pranjal/Library/Application Support/Sublime Text 3/Installed Packages/ImportJS.sublime-package", line 156, in run
BrokenPipeError: [Errno 32] Broken pipe
Version info is as follows:
npm @ 5.6.0
node @ 8.9.4
importjs @ 2.10.0
sublime-import-js @ 1.2.0
@trotzig @lencioni please help?
from sublime-import-js.
This issue was filed when we were still relying on eslint @pranjaltech. My guess would be that importjs
isn't available on the PATH inside sublime. Can you run importjs
in a terminal outside sublime?
from sublime-import-js.
@trotzig Yep, I can run importjs outside sublime.
$ which importjs
/usr/local/bin/importjs
I noticed that running importjs is not giving any useful output. Eg. -
$ importjs fix ./source/components/Post.js
The output is:
{
"fileContent": "// The actual contents of the file",
"messages": [],
"unresolvedImports": {}
}
from sublime-import-js.
@trotzig It's working now! Thanks for pointing me in the right direction –
My guess would be that importjs isn't available on the PATH inside sublime.
I had recently downgraded from node@9
to node@8
via homebrew, but instead of unlinking the previously installed version, I'd just added the node@8 path to my ~/.zshrc
. After reading your comment I realised that Sublime isn't reading from my ~/.zshrc
file.
To fix the issue, I just ran:
brew unlink node
brew link node@8 --force
npm uninstall -g import-js
npm install -g import-js
and it works!
from sublime-import-js.
Related Issues (18)
- Make sublime plugin async HOT 5
- Python error: Can't convert 'NoneType' object to str implicitly
- Fix all imports freezes Sublime_text 3 HOT 5
- How can we configure .importjs.js which is documented in https://github.com/Galooshi/import-js? HOT 3
- Importjs for Angular5 HOT 3
- OSError: [Errno 22] Invalid argument HOT 4
- Improve compatibility with nvm HOT 18
- Code of conduct link is invalid in CONTRIBUTING.md HOT 2
- Doesn't work with [email protected] HOT 3
- Not importing prop-types HOT 4
- .import.js config file not work
- Couldn't find executable importjsd. HOT 2
- add import statement in top of a html file HOT 2
- Running ImportJS command... Commands no longer working HOT 2
- .sublime-settings are ignored - documentation error?
- Mysterious line-break inserted HOT 6
- When fixing and asking for selections, does not import words that do not need prompts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sublime-import-js.