3

I am very new to Linux so my question may seem stupid however I cannot install Node.js and npm software successfully. More precisely, the installation is completed but when I am trying to run some graphics software I get an error.

In detail:

I want to run this software which somehow enables Node.js for rendering graphics:

https://github.com/clementfarabet/gfx.js

and the problem occurs when I am trying to install luarocks (found also in the above link).

 npm ERR! [email protected] install: `node-gyp rebuild` 
 npm ERR! Exit status 1 
 npm ERR!  npm ERR! Failed at the [email protected] install script. 
 npm ERR! This is most likely a problem with the pty.js package, 
 npm ERR! not with npm itself. 
 npm ERR! Tell the author that this fails on your system: 
 npm ERR! node-gyp rebuild 
 npm ERR! You can get their info via: 
 npm ERR! npm owner ls pty.js npm ERR! There is likely additional logging output above.

 npm ERR! System Linux 3.11.0-12-generic 
 npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" 
 npm ERR! cwd /tmp/luarocks_gfx.js-scm-0-9502/gfx.js npm ERR! node -v v0.11.13-pre
 npm ERR! npm -v 1.4.3 npm ERR! code ELIFECYCLE

Also when I am trying to start the graphics mode I get the following error:

[gfx.js] server started on port 8000, graphics will be rendered into http://localhost:8000
deep_unlearn@Deep:~/node_modules$ module.js:333
    throw err;
          ^
Error: Cannot find module 'pty.js'
    at Function.Module._resolveFilename (module.js:331:15)
    at Function.Module._load (module.js:273:25)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object. (/home/deep_unlearn/.gfx.js/lib/tty.js:17:11)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)

I suspect that the problem is that npm can not find the pty.js module even though is installed in my system. So I looked for the path and I realized that the software is installed in the following structure:

~root/node_modules/express/node_modules/pty.js

However the software seems to look for this files in:

~root/node_modules/

Can someone please advice me on this matter? If this is the problem is there a way to fix this problem?

0

1 Answer 1

2

Install Node.js

On the app server, let's update the apt-get package lists with this command

sudo apt-get update

Then use apt-get to install Node.js build dependencies:

sudo apt-get install -y build-essential openssl libssl-dev pkg-config

The next step is download the source code for the latest release of Node.js.

Go to the Node.js Downloads page and find the Source Code download link. Right-click it, and copy its link address to your clipboard. After that download using wget like

cd ~
wget http://nodejs.org/dist/latest/node-v0.10.33.tar.gz

Now extract the tar archive you just downloaded with this command:

tar xvf node-v*

Configure and build Node.js with the following commands:

./configure
make

Now, to install Node.js, run this command:

sudo make install

If you want to delete the Node.js source code that you downloaded, change to your home directory and use this rm command:

cd ~
rm -rf node-v*

The Node.js runtime is now installed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .