nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.46k stars 279 forks source link

/bin/sh: python: not found #71

Closed YounsooChoi closed 8 years ago

YounsooChoi commented 8 years ago

I have python2.7 in /opt/bin/python2.7 I followed guide in README.md

$ export PYTHON=/path/to/python
$ $PYTHON ./configure
$ make
$ [sudo] make install

and I got:

[usagicore@RT-AC68U-3B08 node]$ export "PYTHON=/opt/bin/python2.7"
[usagicore@RT-AC68U-3B08 node]$ $PYTHON ./configure
creating  ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'arm_float_abi': 'default',
                 'arm_fpu': 'vfpv3',
                 'arm_thumb': 0,
                 'arm_version': '7',
                 'asan': 0,
                 'gas_version': '2.25',
                 'host_arch': 'arm',
                 'icu_small': 'false',
                 'node_byteorder': 'little',                                                'node_enable_v8_vtunejit': 'false',                                        'node_install_npm': 'true',                                                'node_prefix': '/usr/local',                                               'node_release_urlbase': '',                                                'node_shared_http_parser': 'false',                                        'node_shared_libuv': 'false',                                              'node_shared_openssl': 'false',                                            'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_use_dtrace': 'false',                                                'node_use_etw': 'false',
                 'node_use_lttng': 'false',
                 'node_use_openssl': 'true',                                                'node_use_perfctr': 'false',
                 'openssl_fips': '',
                 'openssl_no_asm': 0,
                 'python': '/opt/bin/python2.7',
                 'target_arch': 'arm',
                 'uv_parent_path': '/deps/uv/',
                 'uv_use_dtrace': 'false',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_random_seed': 0,
                 'v8_use_snapshot': 'true',
                 'want_separate_host_toolset': 0}}
creating  ./config.gypi
creating  ./config.mk
/bin/sh: python: not found
gyp: Call to 'python -c "import sys; print sys.byteorder"' returned exit status 127 while in /tmp/mnt/HDD/!usagicore/git/node/deps/v8/tools/gyp/v8.gyp. while loading dependencies of /tmp/mnt/HDD/!usagicore/git/node/node.gyp while trying to load /tmp/mnt/HDD/!usagicore/git/node/node.gyp
Error running GYP
[usagicore@RT-AC68U-3B08 node]$
Knighton910 commented 8 years ago

why are you doing -> [sudo] make install. Try: sudo make install & are you sure this isn't a python problem on your system?

bnoordhuis commented 8 years ago

Try sudo PYTHON=$PYTHON make install - sudo doesn't inherit the environment for security reasons.

YounsooChoi commented 8 years ago

python used to work with other python programs but the script is keep trying to use /bin/python instead of /opt/bin/python2.7 even though I typed export

[usagicore@RT-AC68U-3B08 node]$ export "PYTHON=/opt/bin/python2.7"         [usagicore@RT-AC68U-3B08 node]$ make install                               /opt/bin/python2.7 tools/gyp_node.py -f make
/bin/sh: python: not found                                                 gyp: Call to 'python -c "import sys; print sys.byteorder"' returned exit status 127 while in /tmp/mnt/HDD/!usagicore/git/node/deps/v8/tools/gyp/v8.gyp.                                                                          Makefile:53: recipe for target 'out/Makefile' failed
make: *** [out/Makefile] Error 1
YounsooChoi commented 8 years ago
[usagicore@RT-AC68U-3B08 node]$ export "PYTHON=/opt/bin/python2.4"
[usagicore@RT-AC68U-3B08 node]$ PYTHON=$PYTHON make install                /opt/bin/python2.7 tools/gyp_node.py -f make                               /bin/sh: python: not found
gyp: Call to 'python -c "import sys; print sys.byteorder"' returned exit status 127 while in /tmp/mnt/HDD/!usagicore/git/node/deps/v8/tools/gyp/v8.gyp.
Makefile:53: recipe for target 'out/Makefile' failed
make: *** [out/Makefile] Error 1
bnoordhuis commented 8 years ago

If it's in v8.gyp, there isn't much we can do about that. I've tried getting a patch accepted upstream that made the python binary configurable but it got rejected.

Knighton910 commented 8 years ago

http://stackoverflow.com/questions/17706310/how-to-add-path-with-module-to-python

git clone https://chromium.googlesource.com/external/gyp cd gyp sudo ./setup.py install

what about something like this?

glensc commented 8 years ago

how about:

PYTHON=/opt/bin/python2.7
ln -s $PYTHON python
PATH=$(pwd):$PATH $PYTHON ./configure
PATH=$(pwd):$PATH $PYTHON make
YounsooChoi commented 8 years ago

doesn't work. same output On Jan 8, 2016 4:00 AM, "Elan Ruusamäe" notifications@github.com wrote:

how about:

PYTHON=/opt/bin/python2.7 ln -s $PYTHON python PATH=$(pwd):$PATH $PYTHON ./configure PATH=$(pwd):$PATH $PYTHON make

— Reply to this email directly or view it on GitHub https://github.com/nodejs/help/issues/71#issuecomment-169774153.

glensc commented 8 years ago

paste exact output including commands you typed.

YounsooChoi commented 8 years ago

sorry i was being idiot

ASUSWRT-Merlin RT-AC68U_3.0.0.4 Thu Dec 24 18:54:10 UTC 2015
[usagicore@RT-AC68U-3B08 root]$ cd /tmp/mnt/HDD/!usagicore/git/node*
[usagicore@RT-AC68U-3B08 node]$ PYTHON=/opt/bin/python2.7
[usagicore@RT-AC68U-3B08 node]$ ln -s $PYTHON python
ln: python: File exists
[usagicore@RT-AC68U-3B08 node]$ PATH=$(pwd):$PATH $PYTHON ./configure
creating  ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'arm_float_abi': 'default',
                 'arm_fpu': 'vfpv3',
                 'arm_thumb': 0,
                 'arm_version': '7',
                 'asan': 0,
                 'gas_version': '2.25',
                 'host_arch': 'arm',
                 'icu_small': 'false',
                 'node_byteorder': 'little',
                 'node_enable_v8_vtunejit': 'false',
                 'node_install_npm': 'true',
                 'node_prefix': '/usr/local',
                 'node_release_urlbase': '',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_lttng': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'openssl_fips': '',
                 'openssl_no_asm': 0,
                 'python': '/opt/bin/python2.7',
                 'target_arch': 'arm',
                 'uv_parent_path': '/deps/uv/',
                 'uv_use_dtrace': 'false',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_random_seed': 0,
                 'v8_use_snapshot': 'true',
                 'want_separate_host_toolset': 0}}
creating  ./config.gypi
creating  ./config.mk
[usagicore@RT-AC68U-3B08 node]$ PATH=$(pwd):$PATH $PYTHON make
/opt/bin/python2.7: can't open file 'make': [Errno 2] No such file or directory
[usagicore@RT-AC68U-3B08 node]$

at last just make seems working

glensc commented 8 years ago

ah, sorry, i intended to remove python from make, but seems i still left it in for final post, it should had been:

PATH=$(pwd):$PATH make
YounsooChoi commented 8 years ago
  g++ -pthread -rdynamic -B/tmp/mnt/HDD/!usagicore/git/node/  -o /tmp/mnt/HDD/!usagicore/git/node/out/Release/mksnapshot -Wl,--start-group /tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/mksnapshot.o /tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a /tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_libplatform.a /tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/deps/v8/tools/gyp/libv8_libbase.a -Wl,--end-group -ldl -lrt
  LD_LIBRARY_PATH=/tmp/mnt/HDD/!usagicore/git/node/out/Release/lib.host:/tmp/mnt/HDD/!usagicore/git/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/v8_snapshot/geni; "/tmp/mnt/HDD/!usagicore/git/node/out/Release/mksnapshot" --log-snapshot-positions --logfile "/tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/v8_snapshot/geni/snapshot.log" --startup_src "/tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc" ""
/tmp/mnt/HDD/!usagicore/git/node/out/Release/mksnapshot: can't load library 'libdl.so.1'
deps/v8/tools/gyp/v8_snapshot.target.mk:13: recipe for target '/tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc' failed
make[1]: *** [/tmp/mnt/HDD/!usagicore/git/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 16
make[1]: Leaving directory '/tmp/mnt/HDD/!usagicore/git/node/out'
Makefile:45: recipe for target 'node' failed
make: *** [node] Error 2
glensc commented 8 years ago

similarily to $PATH you can add path to libdl.so.1 via $LD_LIBRARY_PATH on linux (osx it's a bit different variable, google it), i.e if libdl.so.1 is in /opt/lib, do:

export LD_LIBRARY_PATH=/opt/lib${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH}

but seems you have some weird platform, did you try googling for: a) pre-built binaries b) how to compile nodejs for that platform?

also, it would be a lot easier (instead of env hacking) if you just symlink your needed tools to /usr/bin (or /usr/local/bin) and /usr/lib (or /usr/local/lib) appropriately, as those are usually in $PATH and ld search path

willin commented 7 years ago

mark

nsinha91 commented 6 years ago

I did not have node-gyp installed. node-gyp is a tool which compiles Node.js Addons (more here).

All I did was: sudo apt-get install node-gyp

And then ran the ./configure and make commands. Ran like a charm.