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

JsHint broke on Sublime Text 2 #33

Closed
lifeinafolder opened this issue Oct 16, 2012 · 27 comments

Comments

@lifeinafolder
Copy link

@lifeinafolder lifeinafolder commented Oct 16, 2012

Error I am getting on build:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Cannot find module './../lib/cli'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/jshint/bin/hint:2:1)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
[Finished in 0.1s with exit code 1]
@uipoet

This comment has been minimized.

Copy link
Owner

@uipoet uipoet commented Oct 16, 2012

Bummer. I'll take a look after work today.

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Nov 20, 2012

Broken on mine for Sublime Text 2 as well.

[Errno 2] No such file or directory
[cmd:  [u'node', u'/Users/willayers/Library/Application Support/Sublime Text 2/Packages/Sublime-    JSHint/scripts/run.js', u'application.js', u'browser: true', u'v8: true', u'es5: true', u'esnext: true', u'globalstrict: true', u'strictundef: true', u'laxradix: true', u'trailing: true', u'undef: false', u'sub: true']]
@bautistaI

This comment has been minimized.

Copy link

@bautistaI bautistaI commented Dec 17, 2012

This is what I get on mine:

[Errno 2] No such file or directory
[cmd: [u'jshint', u'/Users/IB/Desktop/Email/index.html', u'--reporter', u'/Users/IB/Library/Application Support/Sublime Text 2/Packages/JSHint/reporter.js']]
[dir: /Users/IB/Desktop/Email]
[path: /usr/local/bin:/opt/local/bin]
[Finished]

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Dec 17, 2012

@bautistaI I had fixed this but I can not remember how. When does this happen for you?

@bautistaI

This comment has been minimized.

Copy link

@bautistaI bautistaI commented Dec 17, 2012

It shows whenever I save a file, like my index.html

Sincerely,
Israel Bautista
www.israelbautista.com

On Dec 17, 2012, at 1:15 PM, Will Ayers notifications@github.com wrote:

@bautistaI I had fixed this but I can not remember how. When does this happen for you?


Reply to this email directly or view it on GitHub.

@bautistaI

This comment has been minimized.

Copy link

@bautistaI bautistaI commented Dec 17, 2012

Here's a little video showing the behavior.

Sincerely,
Israel Bautista
www.israelbautista.com

On Dec 17, 2012, at 1:15 PM, Will Ayers notifications@github.com wrote:

@bautistaI I had fixed this but I can not remember how. When does this happen for you?


Reply to this email directly or view it on GitHub.

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Dec 18, 2012

I don't see a video

@bautistaI

This comment has been minimized.

Copy link

@bautistaI bautistaI commented Dec 18, 2012

try this link, 

https://dl.dropbox.com/u/36990149/IMG_0191.MOV.zip

 
Sincerely,

Israel Bautista
http://www.israelbautista.com


From: Will Ayers notifications@github.com
To: uipoet/sublime-jshint sublime-jshint@noreply.github.com
Cc: Israel Bautista bautista.israel@rocketmail.com
Sent: Monday, December 17, 2012 6:54 PM
Subject: Re: [sublime-jshint] JsHint broke on Sublime Text 2 (#33)

I don't see a video

Reply to this email directly or view it on GitHub.

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Dec 18, 2012

Did you installe Node via homebrew?

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Dec 18, 2012

Ok, found the solution. So the way this is developed you have to manually go in and fix the path in the build file.

In a terminal window type this:
which jshint

copy the path without the jshint in it. It should look something like this:
/usr/local/share/npm/bin

Then open up the file named JSHint.sublime-build located in the folder ~/Library/Application Support/Sublime Text 2/Packages/JSHint

On line 10 add the above path you copied to the "path" value like the following:

"osx": {
    "path": "/usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin"
},

After you save this file you can immediately run cmd + j on the file again.

I hope this helps.

cointilt added a commit to cointilt/sublime-jshint that referenced this issue Dec 18, 2012
This fixed an issue that was not allowing the build when hitting `cmd` + `j` on Sublime Text 2 for Mac.

Related to issue uipoet#33 as well as closed issues uipoet#12 and uipoet#14.
@lifeinafolder

This comment has been minimized.

Copy link
Author

@lifeinafolder lifeinafolder commented Dec 18, 2012

One point of confusion is that there are two packages listed in ST2 Package Manager:

  1. JSHint
  2. Sublime-JSHint

The original error I reported is on package (1). Now I believe this discussion is around package (1) too.

Now which jshint on my box gives the path /usr/local/bin/jshint and the JSHint.sublime-build file mentioned looks like this on my box:

{
  "selector": "source.js",

  "cmd": ["jshint", "$file", "--reporter", "$packages/JSHint/reporter.js"],

  "file_regex": "file:(.+)\\]",
  "line_regex": "(\\d+),(\\d+)",

  "osx": {
    "path": "/user/local/share/npm/bin:/usr/local/bin:/opt/local/bin"
  },

  "windows": {
    "cmd": ["jshint.cmd", "$file", "--reporter", "$packages\\JSHint\\reporter.js"]
  }
}

So that path is already there in it yet still it doesn't work and I get the original error mentioned by me.

@bautistaI

This comment has been minimized.

Copy link

@bautistaI bautistaI commented Dec 18, 2012

I installed via package control

Sincerely,
Israel Bautista
www.israelbautista.com

On Dec 17, 2012, at 9:30 PM, Will Ayers notifications@github.com wrote:

Did you installe Node via homebrew?


Reply to this email directly or view it on GitHub.

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Dec 18, 2012

@bautistaI did you run this command npm install -g jshint

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Dec 18, 2012

@lifeinafolder the correct package is option 1 JSHint

I got confused by that the first time as well. Just make sure the match up the url under the name with this repo if you are not sure.

@lifeinafolder

This comment has been minimized.

Copy link
Author

@lifeinafolder lifeinafolder commented Dec 19, 2012

@cointilt I did install option 1. But as mentioned in my previous message, it still doesn't work even when the path in my build file is fine.

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Dec 19, 2012

@lifeinafolder did you install node via homebrew and then jshint via npm?

@lifeinafolder

This comment has been minimized.

Copy link
Author

@lifeinafolder lifeinafolder commented Dec 20, 2012

Not sure if I installed node via homebrew. Jshint was installed via npm for sure.

Is that going to cause an issue?

@cointilt

This comment has been minimized.

Copy link
Contributor

@cointilt cointilt commented Dec 20, 2012

Try installing it via homebrew and see if that works.

@uipoet

This comment has been minimized.

Copy link
Owner

@uipoet uipoet commented Jan 27, 2013

As the README says, jshint installed via npm should work out of the box for Macintosh and Windows. For Linux, you'll need to also make sure that the path to the jshint binary has been added to your environment's $PATH.

I have just installed a clean version on Macintosh and Linux to confirm things are working as expected and are. There are several questions wrapped up in this single thread so I'm going to close and suggest you open a new more specific issue, if that is indeed the case.

@uipoet uipoet closed this Jan 27, 2013
@stevematdavies

This comment has been minimized.

Copy link

@stevematdavies stevematdavies commented Jun 26, 2014

The above solutions do not fix the error on Linux (Ubuntu 14:04) sublimeText 2

@jac1013

This comment has been minimized.

Copy link

@jac1013 jac1013 commented Jul 4, 2014

I solved this problem in Linux Mint 17 for ST2 with:

sudo npm install jshint -g

@fox94610

This comment has been minimized.

Copy link

@fox94610 fox94610 commented Jul 29, 2014

Pictures might help
Path to non-Sublime jshint program will vary
Path to node will vary
I couldn't figure what :/opt/local/bin is, since it does not exist on my computer, even so jshint package works in sublime for me now.

paths1
paths2
paths3
paths4
paths5

@goramm

This comment has been minimized.

Copy link

@goramm goramm commented Nov 12, 2014

For Ubuntu 14.04 and Sublime 3

Find node path with which node (output: /usr/bin/node)

Find jshint path with which jshint (output: /home/username/local/bin/jshint)

Locate JSHint.py with locate JSHint.py

Add following condition in JSHint.py
elif sublime.platform() == "linux":
args['path'] = "/usr/bin:/home/username/local/bin/"

@YoEugene

This comment has been minimized.

Copy link

@YoEugene YoEugene commented Sep 26, 2015

In my case, I found the real problem is not in JSHint.sublime-build file but in JSHint.py file

So the steps are:

  1. Go the your JSHint Folder
    (For me is: ~/Library/Application Support/Sublime Text 3/Packages/JSHint)
  2. open the JSHint.py file inside it
  3. Go to terminal, and enter which jshint to get your path of jshint command
    (For me is: /Users/yoeugene/nvm/v0.10.35/bin/jshint)
  4. Copy the above string before /jshint, and paste it to JSHint.py in the args['path'] part
    (Notice there is no /jshint in the path I paste)
    2015-09-26 10 14 58
  5. Save the file and that's it!! Try again Ctrl+J or Alt+J on your JS file and see if it's working.

P.S. I installed my node via NVM.

@yurychika

This comment has been minimized.

Copy link

@yurychika yurychika commented Oct 3, 2015

@YoEugene
Thanks! It really works perfectly.

@jshamley

This comment has been minimized.

Copy link

@jshamley jshamley commented Dec 18, 2015

Thanks @YoEugene, worked like a charm

@jaywang12

This comment has been minimized.

Copy link

@jaywang12 jaywang12 commented Jan 29, 2016

@YoEugene: thanks, this works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.