开发者

Install node.js on jailed shell

I am trying to install node.js on jailed shell of shared web-server. I have managed to install git, and get a copy of node.开发者_开发问答js. I was compiling like this...

./configure --prefix=~/opt

(I have an ~/opt/bin directory which allows git to execute - so thought it was a good place to put it)

But got errors like this...

/home/sparrow/bin/git/node-v0.4.12/deps/v8/src/platform-linux.cc: In function `void* v8::internal::ThreadEntry(void*)':
/home/sparrow/bin/git/node-v0.4.12/deps/v8/src/platform-linux.cc:587: error: `PR_SET_NAME' was not declared in this scope
/home/sparrow/bin/git/node-v0.4.12/deps/v8/src/platform-linux.cc:587: warning: unused variable 'PR_SET_NAME'
scons: *** [obj/release/platform-linux.o] Error 1
scons: building terminated because of errors.
Waf: Leaving directory `/home/sparrow/bin/git/node-v0.4.12/build'
Build failed:  -> task failed (err #2): 
        {task: libv8.a SConstruct -> libv8.a}
make: *** [program] Error 1

Does anyone know what this error means - and how I can fix my installation?

EDIT: More details...

I had another go, but using ./configure --prefix=~/usr/local/ with similar error - here is the output...

-jailshell-3.00$ ./configure --prefix=~/local
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for program gcc or cc           : /usr/bin/gcc 
Checking for gcc                         : ok  
Checking for library dl                  : yes 
Checking for openssl                     : yes 
Checking for library util                : yes 
Checking for library rt                  : yes 
--- libeio ---
Checking for library pthread             : yes 
Checking for function pthread_create     : yes 
Checking for function pthread_atfork     : yes 
Checking for futimes(2)                  : yes 
Checking for readahead(2)                : yes 
Checking for fdatasync(2)                : yes 
Checking for pread(2) and pwrite(2)      : no 
Checking for sendfile(2)                 : yes 
Checking for sync_file_range(2)          : no 
--- libev ---
Checking for header sys/inotify.h        : not found 
Checking for header sys/epoll.h          : yes 
Checking for function epoll_ctl          : yes 
Checking for header port.h               : not found 
Checking for header poll.h               : yes 
Checking for function poll               : yes 
Checking for header ['sys/types.h', 'sys/event.h'] : not found 
Checking for header sys/queue.h                    : yes 
Checking for function kqueue                       : not found 
Checking for header sys/select.h                   : yes 
Checking for function select                       : yes 
Checking for header sys/eventfd.h                  : not found 
Checking for SYS_clock_gettime                     : yes 
Checking for library rt                            : yes 
Checking for function clock_gettime                : yes 
Checking for function nanosleep                    : yes 
Checking for function ceil                         : yes 
Checking for fdatasync(2) with c++                 : yes 
'configure' finished successfully (5.075s)
-jailshell-3.00$ make && make install
Waf: Entering directory `/home/sparrow/bin/git/node-v0.4.12/build'
DEST_OS: linux
DEST_CPU: x64
Parallel Jobs: 1
Product type: program
[49/75] copy: src/node_config.h.in -> build/default/src/node_config.h
[50/75] copy: tools/nodejs.pc.in -> build/default/tools/nodejs.pc
[51/75] libv8.a: deps/v8/SConstruct -> build/default/libv8.a
/usr/local/bin/python "/home/sparrow/bin/git/node-v0.4.12/tools/scons/scons.py" -j 1 -C "/home/sparrow/bin/git/node-v0.4.12/build/default/" -Y "/home/sparrow/bin/git/node-v0.4.12/deps/v8" visibility=default mode=release arch=x64 toolchain=gcc library=static snapshot=on
scons: Reading SConscript files ...

scons: warning: Ignoring missing SConscript 'obj/test/release/SConscript'
File "/home/sparrow/bin/git/node-v0.4.12/deps/v8/SConstruct", line 1201, in BuildSpecific
scons: done reading SConscript files.
scons: Building targets ...
g++ -o obj/release/platform-linux.o -c -Wall -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -m64 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -fno-rtti -fno-exceptions -Wall -W -Wno-unused-parameter -Wnon-virtual-dtor -pedantic -m64 -O3 -fomit-frame-pointer -fdata-sections -ffunction-sections -ansi -DV8_TARGET_ARCH_X64 -DENABLE_VMSTATE_TRACKING -DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT -I/home/sparrow/bin/git/node-v0.4.12/deps/v8/src /home/sparrow/bin/git/node-v0.4.12/deps/v8/src/platform-linux.cc
/home/sparrow/bin/git/node-v0.4.12/deps/v8/src/platform-linux.cc: In function `void* v8::internal::ThreadEntry(void*)':
/home/sparrow/bin/git/node-v0.4.12/deps/v8/src/platform-linux.cc:587: error: `PR_SET_NAME' was not declared in this scope
/home/sparrow/bin/git/node-v0.4.12/deps/v8/src/platform-linux.cc:587: warning: unused variable 'PR_SET_NAME'
scons: *** [obj/release/platform-linux.o] Error 1
scons: building terminated because of errors.
Waf: Leaving directory `/home/sparrow/bin/git/node-v0.4.12/build'
Build failed:  -> task failed (err #2): 
        {task: libv8.a SConstruct -> libv8.a}
make: *** [program] Error 1
-jailshell-3.00$ 


Node.js requires root access which shared servers do not usually provide. Contact your host to check if node commands will work. And by the way, switching from jailshell to normal shell is a prerequisite of node.

You can still follow these steps:

Log in to your account using SSH (if is not enabled for your account contact our support).

At the command prompt, type next commands:

cd ~
wget https://nodejs.org/dist/v6.9.1/node-v6.9.1-linux-x64.tar.xz

Command above will download v6.9.1 version, in case you need diffrent version you can find latest here: https://nodejs.org/en/download/

To extract the Node.js files, type the following command:

tar xvf node-v6.9.1-linux-x64.tar.xz

Now we will rename folder to nodejs name, to do this type the following command:

mv node-v6.9.1-linux-x64 nodejs

Now install node and npm binaries, type the next commands:

mkdir ~/bin
cp nodejs/bin/node ~/bin
cd ~/bin
ln -s ../nodejs/lib/node_modules/npm/bin/npm-cli.js npm

That is all, Node.js and npm are installed on your account. To verify, type the following commands:

node --version
npm --version
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜