![]() | NODE_PATH (page 24) |
|
04 May 2011, 06:40
Vladimir Kelman (15 posts) |
I’m installing Node and CoffeeScript on LinuxMint 10 machine (working under VMware virtual machine). Totally new to Linux, unfortunately. I successfully went through the steps of Chapter 1.1. ”$ node -v”, ”$ npm -v”, and ”$ coffee -v” return meaningful values. ”$ npm ls -g” on my machine returns ”/home/vkelman/local/lib”. So I then typed the following: ”$ export NODE_PATH=/home/vkelman/local/lib/node_modules”. Is it what I was supposed to do? (Again, I’m new to Linux.) Or should I run some command which included ”~/.profile”? What did I do wrong? By the way, LinuxMint has some graphical windows-like system, including an analog of Windows Explorer. So I looked at ”/home/vkelman/local/lib/node_modules” folder and it indeed includes “coffee-script” subfolder. It is here but I didn’t set NODE_PATH properly. |
|
04 May 2011, 16:07
Chad Reynoldson (2 posts) |
I had a similar situation with my mac (and I too am somewhat of a newbie to mac). I found the env command, which showed me that NODE_PATH was not getting set, even though I had added it to the .profile file as instructed. In my case, I’m using the zsh shell and I ended up editing the .zshrc file instead (vim /~.zshrc). I’ve still not convinced myself that this is the best place to put it because if I use something other than zsh, it will fail again. Hope this helps. I ended up learning a lot about the zsh shell, vim, and environment variables in my long search to make it work, so all is not a loss. |
|
04 May 2011, 16:11
Leroy Campbell (3 posts) |
You’ll want to add the line Afterwards, relaunch your terminal, then type |
|
04 May 2011, 16:13
Steven Nunez (4 posts) |
I used bash and added the export to the ~/.bashrc. Worked after that. |
|
04 May 2011, 16:52
Trevor Burnham (51 posts) |
@Vladimir It sounds like you did everything correctly… Did you run
and then immediately run `node` from the same window? (When you run that command, it only sets NODE_PATH for the current bash session. That’s why I say that you should add that line to your ~/.profile file, which bash reads every time it starts a new session.) You can test whether NODE_PATH is set correctly by running |
|
05 May 2011, 01:11
Vladimir Kelman (15 posts) |
OK, I got it working. You know, with my a near-to-zero knowledge of Linux (always wanted to learn it never had time) elementary things turn into issues. You wrote, “On my system, that means adding export NODE_PATH=/usr/local/lib/node_modules Still, further chapters are going to be about CoffeeScript, not about Linux, so I should be able to study it :) |
|
05 May 2011, 03:25
Trevor Burnham (51 posts) |
Believe me, I’ve been there. I wish it weren’t necessary to mess with environmental variables in order to use Node/npm. Maybe some day… glad you got it working, though. If you use Linux, you really should learn either vim or emacs; once you’ve done that, editing ~/.profile is as easy as typing `vim ~/.profile` or `emacs ~/.profile`. (I’m on a Mac using TextMate, so I type `mate ~/.profile`.) |
|
03 Jun 2011, 15:59
Ronald H Bingham (2 posts) |
I was delighted to purchase and read your well written CoffeeScript book I’ve spent nearly a day trying to install node and npm to no avail. After installation everything appears ok.
However when I type When I open a new terminal window, I get the following:
Again a blank line for $NODE_PATH. Here is my ~/.profile file
BTW, I uninstalled macports in my all day effort. |
|
04 Jun 2011, 00:48
Trevor Burnham (51 posts) |
Hi Ronald, Sorry for not replying sooner. What happens when you type If that works around the problem, then the issue is that |
|
05 Jun 2011, 05:01
Ronald H Bingham (2 posts) |
Hi Trevor, Thanks for the reply. Yep, you called it, I’m trying to understand the |
|
06 Jun 2011, 18:45
Trevor Burnham (51 posts) |
Mm, I think the context section of the book explains I’d say the main difference vs. Ruby is that, thanks to the |
|
28 Jun 2011, 23:37
Meng Fung (1 post) |
Hi for Mac users who followed the node.js install using the installation guide found here: https://github.com/joyent/node/wiki/Installation Do this. echo ‘export NODE_PATH=$HOME/local/node/lib/node_modules’ >> ~/.profile This can also help ubuntu users by replacing ~/.profile with ~/.bashrc |
|
31 Jul 2011, 10:50
Zoltán Gerő (2 posts) |
Linux users may need to use .profile to .bashrc file. Important on Ubuntu: Enjoy Coffee:) |
|
27 Jun 2012, 13:14
Migo Fast (1 post) |
I do have coffee script installed I can see it in the directory when I type echo $NODE_PATH into the shell I get /usr/local/lib/node_modules but when I require('coffee-script')
I get Error: Cannot find module 'coffee-script' |
| You must be logged in to comment |

