我正在尝试在共享服务器上安装node / npm进行一些测试。作为它的共享,我正在尝试将它安装在我自己的文件夹中,〜/ usr / bin
我已经提取了tar,可以看到node / npm ...
ls /kunden/homepages/myId/htdocs/usr/bin/nodejs/bin
node npm
如果我回显$ PATH(因为我修改了.bashrc),我看到了文件夹......
/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/local/msql/bin:/usr/games:.:/kunden/homepages/myId/htdocs/usr/bin/nodejs/bin
现在,如果我调用npm或node,它会'找到'节点文件,但后面会说
line 2: /kunden/homepages/myId/htdocs/usr/bin/nodejs/bin/node: No such file or directory
即使我把完整的路径说出来了,所以看起来npm / node正在寻找另一个找不到的文件?
我可以看到它说的文件......
file /kunden/homepages/myId/htdocs/usr/bin/nodejs/bin/node
/kunden/homepages/myId/htdocs/usr/bin/nodejs/bin/node: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
所以我知道在我的路径中它可以看到node / npm很好。是否有其他文件正在寻找我错过了?
编辑:如果我运行一个strace,调试输出是......
execve("/kunden/homepages/myId/htdocs/usr/bin/nodejs/bin/node", ["/kunden/homepages/myId/htdocs/usr/bin/nodejs/bin/node"], [/* 36 vars */]) = -1 ENOENT (No such file or directory)
dup(2) = 3
fcntl64(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x55575000
_llseek(3, 0, 0xffc0b568, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or directory\n", 40strace: exec: No such file or directory
) = 40
close(3) = 0
答案 0 :(得分:0)
如果您从源代码而不是软件包管理器进行安装,请确保按照说明进行操作:
https://github.com/joyent/node/wiki/installation#building-on-linux
通常,从源代码编译时,您最终会执行以下操作:
./ configure&&制造&& sudo make install
注意:这里需要注意,因为如果你没有指定要安装它的路径,它将默认为/ usr / lib&&的/ usr / bin中