我正在尝试在共享Web服务器的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$
答案 0 :(得分:3)
Node.js需要root访问权限,共享服务器通常不提供。联系您的主机以检查节点命令是否有效。顺便说一句,从jailshell切换到普通shell是节点的先决条件。
您仍然可以按照以下步骤操作:
使用SSH登录您的帐户(如果您的帐户未启用,请与我们的支持小组联系)。
在命令提示符下,键入next命令:
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 name,为此键入以下命令:
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