尝试编译官方给的addon例子,运行
node-gyp configure
后出错:
<pre>gyp info it worked if it ends with ok gyp info using node-gyp@0.8.5 gyp info using node@0.8.20 | linux | arm gyp ERR! configure error gyp ERR! stack Error: Command failed: execvp(): Permission denied gyp ERR! stack gyp ERR! stack at ChildProcess.exithandler (child_process.js:540:15) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17) gyp ERR! stack at maybeClose (child_process.js:638:16) gyp ERR! stack at Socket.ChildProcess.spawn.stdin (child_process.js:815:11) gyp ERR! stack at Socket.EventEmitter.emit (events.js:96:17) gyp ERR! stack at Socket._destroy.destroyed (net.js:358:10) gyp ERR! stack at process.startup.processNextTick.process._tickCallback (node.js:244:9) gyp ERR! System Linux 3.6.11-7-ARCH+ gyp ERR! command “node” “/root/opt/node/bin/node-gyp” "configure" gyp ERR! cwd /root/hello gyp ERR! node -v v0.8.20 gyp ERR! node-gyp -v v0.8.5 gyp ERR! not ok </pre> node-gyp的依赖项都装了: <pre> [52.996’C root@alarmpi ~/hello]# python -V Python 2.7.3 [52.996’C root@alarmpi ~/hello]# make -v GNU Make 3.82 Built for armv6l-unknown-linux-gnueabi Copyright © 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. [52.458’C root@alarmpi ~/hello]# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/armv6l-unknown-linux-gnueabihf/4.7.2/lto-wrapper Target: armv6l-unknown-linux-gnueabihf Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,fortran,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --disable-ppl-version-check --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-checking=release --host=armv6l-unknown-linux-gnueabihf --build=armv6l-unknown-linux-gnueabihf --with-arch=armv6 --with-float=hard --with-fpu=vfp Thread model: posix gcc version 4.7.2 (GCC) </pre>
…我到现在都没装上node-gyp
权限不够吧:sudo node-gyp configure
已经是root了,而且系统里也没装sudo,怎么sudo啊?
要怎么解决呢?本来就是要靠它来产生makefile的。
终于找到问题所在了。 因为自己不喜欢把软件包安装到/usr/local里,所以安装完的东西都需要在.bashrc中设置好环境变量。 而在设置python的环境变量时,本来是想将PYTHON_HOME设置成python安装目录的,但打快没看好,把环境变量弄成了PYTHON。 今天在一个VPS上安装nodejs跑个应用的时候,手痒就试试直接用软件包安装工具来安装nodejs,之后又安装了node-gyp到全局的node_modules。运行node-gyp时出错,提示需要python,但我已经在安装nodejs一同将python安装了,但which python时的确没找到。而在node-gyp的出错提示中还有一句,是说可以通过指定PYTHON环境变量来指定python执行文件。按着在VPS弄了,成功运行node-gyp configure。 然后就想在自己的机器上试试,才发现自己把python的安装目录写到了PYTHON环境变量了,把PYTHON改成PYTHON_HOME,运行成功,可以正常node-gyp configure build了。 原来execvp的Permission Denied是由于python的执行文件被指定成了一个目录导致的!