Skip to content

Trying to configure node-gyp with WSL #1346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spences10 opened this issue Nov 28, 2017 · 9 comments
Closed

Trying to configure node-gyp with WSL #1346

spences10 opened this issue Nov 28, 2017 · 9 comments

Comments

@spences10
Copy link

  • Node Version: v8.9.1
  • Platform: Linux DESKTOP-KCGTGRV 4.4.0-43-Microsoft Make 0.6.x work #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
  • Compiler: Reading specs from /home/linuxbrew/.linuxbrew/Cellar/gcc/5.4.0/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/specs
    COLLECT_GCC=cc
    COLLECT_LTO_WRAPPER=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.4.0/libexec/gcc/x86_64-unknown-linux-gnu/5.4.0/lto-wrapp
    er
    Target: x86_64-unknown-linux-gnu
    Configured with: ../configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.4.0 --enable-languages=c,c++,objc,ob
    j-c++,fortran --program-suffix=-5 --with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp --with-mpfr=/home/linuxbrew/.linuxbr
    ew/opt/mpfr --with-mpc=/home/linuxbrew/.linuxbrew/opt/libmpc --with-isl=/home/linuxbrew/.linuxbrew/opt/isl --enable
    -stage1-checking --enable-checking=release --enable-lto --with-build-config=bootstrap-debug --disable-werror --with-
    pkgversion='Homebrew gcc 5.4.0' --with-bugurl=https://github.com/Homebrew/homebrew/issues --with-boot-ldflags='-stat
    ic-libstdc++ -static-libgcc ' --disable-nls --disable-multilib
    Thread model: posix
    gcc version 5.4.0 (Homebrew gcc 5.4.0)
  • Module: Tried to install npm install -g semantic-release-cli
Verbose output (from npm or node-gyp):
⟩ npm install -g semantic-release-cli
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/home/linuxbrew/.linuxbrew/bin/semantic-release-cli -> /home/linuxbrew/.linuxbrew/lib/node_modules/semantic-release-
cli/bin/semantic-release.js

> keytar@4.0.5 install /home/linuxbrew/.linuxbrew/lib/node_modules/semantic-release-cli/node_modules/keytar
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "/usr/lib/python2.7", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/node-g
yp/lib/configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/node-gy
p/lib/configure.js:397:16)
gyp ERR! stack     at F (/home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js
:42:5
gyp ERR! stack     at /home/linuxbrew/.linuxbrew/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:
8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:5)
gyp ERR! System Linux 4.4.0-43-Microsoft
gyp ERR! command "/home/linuxbrew/.linuxbrew/Cellar/node/8.9.1/bin/node" "/home/linuxbrew/.linuxbrew/lib/node_module
s/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/linuxbrew/.linuxbrew/lib/node_modules/semantic-release-cli/node_modules/keytar
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: keytar@4.0.5 (node_modules/semantic-release-cli/node_modules/keytar)
:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: keytar@4.0.5 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ semantic-release-cli@3.2.6
added 2 packages and updated 1 package in 65.389s

When I try set the python env variable with either:

node-gyp --python /home/linuxbrew/.linuxbrew/bin/python2.7

or

node-gyp --python /usr/lib/python2.7

I get the help text pop up, like it's an invalid command:

  Usage: node-gyp <command> [options]

  where <command> is one of:
    - build - Invokes `make` and builds the module
    - clean - Removes any generated build files and the "out" dir
    - configure - Generates a Makefile for the current module
    - rebuild - Runs "clean", "configure" and "build" all at once
    - install - Install node development files for the specified node version.
    - list - Prints a listing of the currently installed node development files
    - remove - Removes the node development files for the specified version

node-gyp@3.6.2  /home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp
node@8.9.1

I have tried to keep everything on WSL for developement but always seem to run into issues with node-gyp

Any advice greatly appreciated

Here is my whereis details:

⟩ whereis python
python: /usr/bin/python3.5 /usr/bin/python3.5m /usr/lib/python2.7 /usr/lib/python3.5 /etc/python3.5 /usr/local/lib/p
ython3.5 /usr/share/python /home/linuxbrew/.linuxbrew/bin/python2.7 /home/linuxbrew/.linuxbrew/bin/python2.7-config
⟩ whereis node
node: /home/linuxbrew/.linuxbrew/bin/node
⟩ whereis npm
npm: /home/linuxbrew/.linuxbrew/bin/npm
⟩ whereis .node-gyp
: /usr/bin/. /usr/sbin/. /usr/lib/. /bin/. /sbin/. /etc/. /lib/. /lib64/. /usr/games/. /usr/local/bin/. /usr/local/s
bin/. /usr/local/etc/. /usr/local/lib/. /usr/local/games/. /usr/include/. /usr/local/. /usr/share/. /home/linuxbrew/
.linuxbrew/bin/. /mnt/c/Program Files (x86)/Intel/iCLS Client/. /mnt/c/Program Files/Intel/iCLS Client/. /mnt/c/Wind
ows/System32/. /mnt/c/Windows/. /mnt/c/Windows/System32/wbem/. /mnt/c/Windows/System32/WindowsPowerShell/v1.0/. /mnt
/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL/. /mnt/c/Program Files/Intel/Intel(R) Managem
ent Engine Components/DAL/. /mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT/. /mnt/c/Prog
ram Files/Intel/Intel(R) Management Engine Components/IPT/. /mnt/c/Program Files/Intel/WiFi/bin/. /mnt/c/Program Fil
es/Common Files/Intel/WirelessCommon/. /mnt/c/ProgramData/chocolatey/bin/. /mnt/c/Program Files/Git/cmd/. /mnt/c/Use
rs/spenc/AppData/Local/Microsoft/WindowsApps/. /mnt/c/Program Files/Microsoft VS Code/bin/. /usr/share/man/cs/. /usr
/share/man/da/. /usr/share/man/de/. /usr/share/man/es/. /usr/share/man/fi/. /usr/share/man/fr/. /usr/share/man/hu/.
/usr/share/man/id/. /usr/share/man/it/. /usr/share/man/ja/. /usr/share/man/ko/. /usr/share/man/man1/. /usr/share/man
/man2/. /usr/share/man/man3/. /usr/share/man/man4/. /usr/share/man/man5/. /usr/share/man/man6/. /usr/share/man/man7/
. /usr/share/man/man8/. /usr/share/man/man9/. /usr/share/man/nl/. /usr/share/man/pl/. /usr/share/man/pt/. /usr/share
/man/pt_BR/. /usr/share/man/ru/. /usr/share/man/sl/. /usr/share/man/sv/. /usr/share/man/tr/. /usr/share/man/zh_CN/.
/usr/share/man/zh_TW/. /usr/share/info/. /home/linuxbrew/.linuxbrew/share/man/. /mnt/c/Users/spenc/gitrepos/.
@bzoz
Copy link
Contributor

bzoz commented Nov 28, 2017

Try export PYTHON=(path to python 2.7 binary) before running node-gyp

@spences10
Copy link
Author

spences10 commented Nov 28, 2017

Thanks @bzoz, Tried that and it's still giving the Error: Can't find Python executable "/usr/lib/python2.7", you can set the PYTHON env variable error

Here is what I entered:

/usr/lib/python2.7
⟩ export PYTHON=(/usr/lib/python2.7)
HOME /home/scott
HOSTTYPE x86_64
INFOPATH /home/linuxbrew/.linuxbrew/share/info:
LANG en_US.UTF-8
LESSCLOSE '/usr/bin/lesspipe %s %s'
LESSOPEN '| /usr/bin/lesspipe %s'
LOGNAME scott
LS_COLORS 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=4'…
MANPATH '/home/linuxbrew/.linuxbrew/share/man'  '.'
NAME DESKTOP-KCGTGRV
OMF_CONFIG /home/scott/.config/omf
OMF_PATH /home/scott/.local/share/omf
PATH '/home/linuxbrew/.linuxbrew/bin'  '/home/scott/bin'  '/home/scott/.'…
PWD /usr/lib/python2.7
SHELL /bin/bash
SHLVL 3
TERM xterm-256color
USER scott
XDG_DATA_DIRS /usr/local/share:/usr/share:/var/lib/snapd/desktop

And my whereis python:

⟩ whereis python
python: /usr/bin/python3.5 /usr/bin/python3.5m /usr/lib/python2.7 /usr/lib/python3.5 /etc/python3.5 /usr/local/lib/p
ython3.5 /usr/share/python /home/linuxbrew/.linuxbrew/bin/python2.7 /home/linuxbrew/.linuxbrew/bin/python2.7-config

@bzoz
Copy link
Contributor

bzoz commented Nov 28, 2017

I meant something like export PYTHON=/usr/bin/python2.7.

The /usr/lib/python2.7 is probably a directory, not an executable. I guess you should set the PYTHON env to /home/linuxbrew/.linuxbrew/bin/python2.7

@bzoz
Copy link
Contributor

bzoz commented Nov 28, 2017

@spences10 Did it work?

@spences10
Copy link
Author

spences10 commented Nov 28, 2017

You're right @bzoz I didn't check that 🙃

And you're right again the binary is in the /home/linuxbrew/.linuxbrew/bin/python2.7 location...

Forgive my ignorance I thought that there would be a symlink if I added a location from the wehreis I don't think I actually know what whereis does.

I'll try this again and let you know.

Thanks for the help 👍

@spences10
Copy link
Author

spences10 commented Nov 28, 2017

I'm not sure if this is any help, first I added the correct path:

export PYTHON=(/home/linuxbrew/.linuxbrew/bin/python2.7)

It took me to the Python repl, so I exit() out, here is the output:

⟩ export PYTHON=(/home/linuxbrew/.linuxbrew/bin/python2.7)
Python 2.7.14 (default, Sep 25 2017, 20:36:51)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
HOME /home/scott
HOSTTYPE x86_64
INFOPATH /home/linuxbrew/.linuxbrew/share/info:
LANG en_US.UTF-8
LESSCLOSE '/usr/bin/lesspipe %s %s'
LESSOPEN '| /usr/bin/lesspipe %s'
LOGNAME scott
LS_COLORS 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=4'…
MANPATH '/home/linuxbrew/.linuxbrew/share/man'  '.'
NAME DESKTOP-KCGTGRV
OMF_CONFIG /home/scott/.config/omf
OMF_PATH /home/scott/.local/share/omf
PATH '/home/linuxbrew/.linuxbrew/bin'  '/home/scott/bin'  '/home/scott/.'…
PWD /mnt/c/Users/spenc
SHELL /bin/bash
SHLVL 3
TERM xterm-256color
USER scott
XDG_DATA_DIRS /usr/local/share:/usr/share:/var/lib/snapd/desktop

Then I checked node-gyp configure here's the output:

⟩ node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.9.1 | linux | x64
gyp info spawn /home/linuxbrew/.linuxbrew/bin/python2
gyp info spawn args [ '/home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/mnt/c/Users/spenc/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/scott/.node-gyp/8.9.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/scott/.node-gyp/8.9.1',
gyp info spawn args   '-Dnode_gyp_dir=/home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/scott/.node-gyp/8.9.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/mnt/c/Users/spenc',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: /mnt/c/Users/spenc) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp/lib/configure.js:3
36:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-43-Microsoft
gyp ERR! command "/home/linuxbrew/.linuxbrew/Cellar/node/8.9.1/bin/node" "/home/linuxbrew/.linuxbrew/bin/node-gyp" "
configure"
gyp ERR! cwd /mnt/c/Users/spenc
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

@bnoordhuis
Copy link
Member

@spences10 Drop the parens in PYTHON=(/path/to/python) and it should work. You can also set python in your .npmrc.

@spences10
Copy link
Author

Thanks @bnoordhuis I now get a different error:

⟩ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.9.1 | linux | x64
gyp info spawn /home/linuxbrew/.linuxbrew/bin/python2.7
gyp info spawn args [ '/home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/mnt/c/Users/spenc/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/scott/.node-gyp/8.9.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/scott/.node-gyp/8.9.1',
gyp info spawn args   '-Dnode_gyp_dir=/home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/scott/.node-gyp/8.9.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/mnt/c/Users/spenc',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: /mnt/c/Users/spenc) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/linuxbrew/.linuxbrew/lib/node_modules/node-gyp/lib/configure.js:3
36:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-43-Microsoft
gyp ERR! command "/home/linuxbrew/.linuxbrew/Cellar/node/8.9.1/bin/node" "/home/linuxbrew/.linuxbrew/bin/node-gyp" "
rebuild"
gyp ERR! cwd /mnt/c/Users/spenc
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

So, making progress 😄

@bnoordhuis
Copy link
Member

You need to be inside the directory of the add-on (native module) you want to build (or pass -C /path/to/addon to node-gyp.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants