编译node.js时出错

时间:2014-05-26 13:49:19

标签: node.js compilation makefile install

我从官方链接下载了git repo,

git clone git://

我跑了./configure && make && make install make install返回错误:

  LINK(target) /usr/local/bin/node/out/Release/node: Finished
  touch /usr/local/bin/node/out/Release/obj.target/node_dtrace_header.stamp
  touch /usr/local/bin/node/out/Release/obj.target/node_dtrace_provider.stamp
  touch /usr/local/bin/node/out/Release/obj.target/node_dtrace_ustack.stamp
  touch /usr/local/bin/node/out/Release/obj.target/node_etw.stamp
  touch /usr/local/bin/node/out/Release/obj.target/node_mdb.stamp
  touch /usr/local/bin/node/out/Release/obj.target/node_perfctr.stamp
  touch /usr/local/bin/node/out/Release/obj.target/specialize_node_d.stamp
make[1]: Leaving directory `/usr/local/bin/node/out'
ln -fs out/Release/node node

#make install

make -C out BUILDTYPE=Release V=1
make[1]: Entering directory `/usr/local/bin/node/out'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/local/bin/node/out'
ln -fs out/Release/node node
/usr/bin/python tools/install.py install '' '/usr/local'
installing /usr/local/bin/node
Traceback (most recent call last):
  File "tools/install.py", line 202, in <module>
    run(sys.argv[:])
  File "tools/install.py", line 197, in run
    if cmd == 'install': return files(install)
  File "tools/install.py", line 130, in files
    action(['out/Release/node'], 'bin/node')
  File "tools/install.py", line 79, in install
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 79, in <lambda>
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 70, in try_copy
    try_unlink(target_path) # prevent ETXTBSY errors
  File "tools/install.py", line 33, in try_unlink
    os.unlink(path)
OSError: [Errno 21] Is a directory: '/usr/local/bin/node'
make: *** [install] Error 1

我真的不熟悉这个,问题是什么?

我用root运行命令,当我搜索错误时,我只找到了权限问题主题但不是这里的情况。

2 个答案:

答案 0 :(得分:0)

我将node.js源代码下载到/usr/local/bin/node,node.js可以很好地编译到文件夹/usr/local/bin/node/out,然后尝试将它的链接/可执行文件安装到/usr/local/bin/node这是一个文件夹。

OSError: [Errno 21] Is a directory: '/usr/local/bin/node'

解决方案:

重命名文件夹/usr/local/bin/node(如/usr/local/bin/node-src)并重复安装过程。

编译好:

giant:/usr/local/bin/node-src# l ../
total 14228
-rwxr-xr-x  1 root staff 14562901 May 26 14:12 node
drwxr-sr-x 11 root staff     4096 May 26 14:16 node-src
lrwxrwxrwx  1 root staff       38 May 26 14:16 npm -> ../lib/node_modules/npm/bin/npm-cli.js

答案 1 :(得分:0)

如果您没有安装必备软件包,则可能会出现此错误。所以,试试以下

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

如果您的系统中已成功安装所有软件包,请执行以下操作

sudo apt-get install libc-ares2 libev4 libv8-3.7.12.22 nodejs

之后只需输入

node -v

检查它是否正确解决了您的问题。