linux - 在 jailed shell 上安装 node.js

标签 linux node.js installation

我正在尝试在共享网络服务器的 jailed shell 上安装 node.js。我设法安装了 git,并获得了 node.js 的副本。我是这样编译的……

./configure --prefix=~/opt

(我有一个允许 git 执行的 ~/opt/bin 目录 - 所以认为这是放置它的好地方)

但是有这样的错误...

/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

有人知道这个错误是什么意思吗?我该如何修复我的安装?

编辑:更多细节...

我还有一次尝试,但使用 ./configure --prefix=~/usr/local/ 时出现类似错误 - 这是输出...

-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 需要共享服务器通常不提供的根访问权限。联系您的主机以检查 Node 命令是否有效。顺便说一下,从 jailshell 切换到普通 shell 是 node 的先决条件。

您仍然可以按照以下步骤操作:

使用 SSH 登录您的帐户(如果您的帐户未启用,请联系我们的支持人员)。

在命令提示符下,键入下一个命令:

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

上面的命令将下载 v6.9.1 版本,如果您需要不同的版本,您可以在这里找到最新版本:https://nodejs.org/en/download/

要提取 Node.js 文件,请键入以下命令:

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

现在我们将文件夹重命名为 nodejs 名称,为此键入以下命令:

mv node-v6.9.1-linux-x64 nodejs

现在安装 node 和 npm 二进制文件,键入下一个命令:

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

就是这样,Node.js 和 npm 已安装到您的帐户中。要验证,请键入以下命令:

node --version
npm --version

关于linux - 在 jailed shell 上安装 node.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7576515/

相关文章:

编译示例 c 文件作为更大的基于 make 的 C 项目的一部分?

java - 即使 Java 线程在系统调用上等待/阻塞,它们是否仍显示为可运行?

c++ - 如何将 char* 变量转换/放入 struct sockaddr 中?

javascript - NodeJS Express 函数未定义

android - 在 Heroku 上使用 node.js 的 Pusher/PubNub 替代方案

node.js - Nodemailer 在 Azure 上抛出错误

windows - Vagrant 无法识别 x64-Windows7 上的 VirtualBox(已经在运行 JRuby)

mysql - 让 MySQL 在 CentOs 5 上运行

linux - Eyaml 和 Puppet

c - GDB 在 Linux 中带有 coredump 文件