io.js already in WebStorm

io_1.0.0

Are you as excited about the release of io.js 1.0 as we are?
io.js is a fork of Node.js that is using the very latest version of V8 and brings ES6 features and lots of changes and improvements in the core modules.

Here’s a short checklist that can help you prepare WebStorm to work with io.js.

In Node.js configuration (Preferences | Languages & Frameworks | Node.js and NPM), set up the path to the io.js executable. This path is used when creating new Run/Debug configurations to start and debug your app:

path-to-node-config

By default, io.js Mac installer symlinks the io.js binary to /usr/local/bin/node, so no changes may be needed. However, if you’re using nvm on your Mac or Linux, you should set the path explicitly to the io.js binary.

Next, download io.js source files to get code completion for the methods from the core modules. At the moment, WebStorm can’t download them automatically, so please follow the link to iojs.org/dist and get tar.gz for the io.js version you use.

Then click Configure… under Sources of Node.js core modules, select Directory and specify the location of the downloaded sources:

core-modules-config

In JavaScript preferences (Preferences | Languages & Frameworks | JavaScript), you can select ECMAScript 6 as a JavaScript version.

Make sure that the external libraries Node.js Globals and io.js core modules (listed by the name Node.js v1.0.1 core modules) are selected:

list-of-js-libraries

Now you should be able to get new methods resolved and autocompleted.

node-buffer

You can run, debug and profile io.js code using WebStorm’s Node.js run/debug and spy-js for Node.js configurations.

Develop with pleasure!
– JetBrains WebStorm Team

About Ekaterina Prigara

Ekaterina Prigara is WebStorm product marketing manager at JetBrains. She's passionate about new technologies, UX and coffee.
This entry was posted in Cool Feature, Tutorials and tagged , . Bookmark the permalink.

23 Responses to io.js already in WebStorm

  1. erwann says:

    I’d be more excited about an EmberJS plugin :)

  2. Joshua Wright says:

    Thank you very much Ekaterina, just setup my environment with io.js thanks to your article.

  3. Joseph Grace says:

    Should this work in RubyMine also? I have not been able to get autocomplete working for node core modules in NodeJS and, even after following your instructions, nor for IoJS.

    Is there a bug in RubyMine 7.0.3 (January 17,2015)? RubyMine shows the node_modules local modules, but not the core modules.

    Very frustrating. Any suggestions? Is there anything missing from the instructions, or any reason it would not work? Thanx.

    • Joseph Grace says:

      FYI: On OSX 10.10.2.
      Also tried non-iojs, node 0.11.16.

    • Joseph Grace says:

      More detail:

      The require()s do not autocomplete (yet other stuff seems to). Suggestions to get require()s working?

      Thanks.

      • Ekaterina Prigara says:

        You have Node.js plugin installed, right?
        Have you downloaded core modules like suggested in the blog post and them enabled them (core modules) in Languages & Frameworks | JavaScript | Libraries? Tried in RubyMine 7.0.3, works fine.

  4. Joseph Grace says:

    Ekaterina:

    First of all, thank you for the swift testing and reply. Yes, (I believe) I did follow all the steps, including the source download (though perhaps it didn’t process the sources? dialogue didn’t seem to show up with iojs) for core modules. I believe it actually works better than I thought when I first posted. It does do IntelliSense for methods (I believe). However, the requires do not show up. Also it knows some of the documentation. So it knows where to find methods but not how to require those methods.

    I’m wondering if there’s a double-standard for PATHs? I use nvm on OSX, so I rely on nvm to get the NODE_PATH right. Could that be a factor? I tried the iojs article instructions thinking a manual install of iojs might set things right… but it did not. So now I have an iojs and an nvm installed (and things seem the same as before, but I hope iojs didn’t mess with anything too much).

    So my mystery is how to get all the standard requires to show up. Specifically, the local requires (from my node_modules) show up. But the system/core modules (e.g., http) are nowhere to be found. Does that help narrow down the issue?

    Thank you.

    • Joseph Grace says:

      “require those methods” → require those files.

      I should say, my goal is to get nvm working with latest Node, e.g., 0.11.16 (not necessarily iojs). I just tried the iojs article as an alternative to get things working once and for all (which didn’t actually change things, AFAICTell). I do plan on experimenting with iojs but I’m waiting for nvm to support it.

      Thank you for your help and clarification.

    • Ekaterina Prigara says:

      The dialog shows up when you click Configure on the Node.js and npm configuration page. I manually downloaded and unpacked the io.js sources and then pointed WebStorm to the directory with the sources. Please double check that you have both core modules and Node.js globals libraries checked in JavaScript | Libraries.
      With these two checked RubyMine should be able to resolve require(‘http’) (cmd-click on http should get you to the downloaded io.js sources.
      I don’t think that the issue is related to the io.js installation. The mechanism that provides code completion in this case is actually non-specific to Node.js, it’s how WebStorm works with any JavaScript libraries. Please have a look at this blog post, section about adding a file or folder as a js external library.

      • Joseph Grace says:

        Katerina:

        Thank you for clarifications. Quick reply before looking at blog post.

        1) “NodeJS Globals” is checked. I added “Node.js v0.11.16 Core Modules” Globals as you suggested. I forgot to add it back when switching away from iojs. Unfortunately, the setting did not seem to fix the require() autocompletion. The cmd-hover does work on the node_modules require()s, but still not require(‘http’) for example. I did Quit and restart RubyMine for full effect, but no joy. Still no require() autocompletion.

        I am now going to read the blog article you suggested, and will follow-up/report back when I try what I learn there.

        Thank you.

        • Joseph Grace says:

          Hmm, I’m not sure my last post from yesterday showed up, as I don’t see it now.

          I read the blog article which improved my understanding. I ran through a lot of what-if’s trying to get the core modules to show up. As before, the local node_modules highlight/hyperlink properly, and I noticed that the actual “require” also does (from node-globals-stub.js). However, the ‘http’ and the ‘fs’ refuse to play (no highlight/hyperlink).

          Status:
          Settings -> Plugins -> NodeJS — check
          Settings -> Lang & F/w -> JS -> Libs -> Node.js Globals — check
          Settings -> Lang & F/w -> JS -> Libs -> NodeJS v0.11.16 Core Modules — check
          Settings -> Lang & F/w -> NodeJS & NPM -> Interpreter -> ‘/Users/user/.nvm/v0.11.16/bin/node’
          Settings -> Lang & F/w -> NodeJS & NPM -> Sources of Node.js Core Modules -> ‘Node.js v0.11.16 Core Modules is setup.’
          Settings -> Lang & F/w -> NodeJS & NPM -> Sources of Node.js Core Modules -> ‘Edit usage scope’ -> Entire project.
          Settings -> Lang & F/w -> NodeJS & NPM -> Interpreter -> Packages -> NO index internal node modules
          Settings -> Lang & F/w -> NodeJS & NPM -> Interpreter -> Packages -> ALL modules up-to-date.

          I do wish that I had a way to un/re-install NodeJS sources, just to ensure they’re installed/indexed properly, but I do not see a way.

          You can see I am using NVM. Does RubyMine/IntelliJ IDEs use any environment variables to find stuff, or is it all independent of shell variables?

          So the autocompletion for node core modules is still not working, and I do not know why.

          Thank you for you help.

  5. Joseph Grace says:

    Ekaterina:

    No joy. I do get blue hyperlink highlighting of “require” (node-globals-stub.js), but not on ‘http’ or ‘fs’, unfortuantely.

    I read the blog entry and moved and reinstalled iojs without success. I also tried a few of the other Core Modules entries. I moved iojs into my project. I tried using it as a project only library. No luck. My RubyMine just doesn’t want to recognize http for some reason.

    FYI, for iojs-v1.0.4, I added the lib subdirectory (not the entire folder) since that was where the http.js etc. were and that seemed like the proper externals folder. Also, I configured the iojs as a Node.js Core Modules. Then I tried as a global library. Still no luck.

    I tried configuring and compiling iojs in case that made a difference. No luck.

    The “require” looks up fine (node-globals-stub.js), and the local node_module’s are hyperlinking, but the ‘http’ and the ‘fs’ refuse to activate (hyperlink/autocomplete).

    Thank you for your help solving this issue.

    • Ekaterina Prigara says:

      Please try File | Invalidate Caches / Restart…
      If it doesn’t help, please go to JavaScript | Libraries, select your configured Core modules, click edit and attach a screenshot of a dialog that would appear.
      You can contact our tech support using this form, select WebStorm as a product.

      • Joseph Grace says:

        Ekaterina:

        As suggested, I did File | Invalidate Caches / Restart…
        No joy.

        So I have followed your instructions and filed a bug report using the link you provided. I tried to recap what we discussed here in terms of my configuration. I hope that helps. If you have any more suggestions or tips, please let me know.

        And thank you for your prompt, persistent, and persevering help! Much appreciated.

        • Ekaterina Prigara says:

          Have my colleague, our support engineer helped you? All fine now?

          • Joseph Grace says:

            Yes, I now have full autocompletion for NodeJS v0.11.16 and iojs-v1.1.0 Core Modules. One or the key seemed to be removing old NodeJS Core libraries and reinstalling v0.11.16. I tried to pin down that precise steps that made the difference without success. But definitely remove/reconfigure of Core Modules began to get things working.

            And your article on iojs was the first case where I was able to get autocompletion working. Thank you for the key information and example!

            All good now.

          • Joseph Grace says:

            Yes, all good now. Your article was excellent, the support superb, and I now have full autocompletion for require(”) and methods, for both iojs-v1.1.0 and NodeJS v0.11.16 Core Modules. Sweet!-)

            Thank you.

  6. Joseph Grace says:

    Ekaterina (and all support at WebStorm/RubyMine):

    Thank you for your steady and effective help. The key for me (seemed to be) doing a Remove of v0.11.16 and reinstall/reconfigure of sources via download. Once reset, the library began highlighting/hyperlinking the require modules as expected. With a little more fiddling (perhaps adding documentation URL to v0.11.16?) I somehow not only get local node_modules but even get Core Modules autocompletion now. So starting with just require(‘_cursor_’), I type (on OSX) ^ and I get full require(”) autocompletion options including my local node_modules and the NodeJS Core Modules, e.g.g, require(‘fs’) and require(‘http’) in RubyMine.

    So now both iojs-v1.1.0 and Node.JS v.0.11.16 Core Modules have full autocompletion support in RubyMine even including require(”) suggestions.

    Sweet!

    I hope this thread helps the next person.

    Thank you for all your article for iojs (which also fully autocompletes now, by the way), and all your prompt, superb, and thorough support.

  7. Joseph Grace says:

    Re-edit due to HTML filtering (and fix a few typos):

    So starting with just require(‘_cursor_’), I type (on OSX) Ctrl-Space and get full require(”) autocompletion options including my local node_modules and the NodeJS Core Modules, e.g., require(‘fs’) and require(‘http’) in RubyMine.

Leave a Reply

Your email address will not be published. Required fields are marked *