tty.js icon indicating copy to clipboard operation
tty.js copied to clipboard

build fails under arch

Open flying-sheep opened this issue 12 years ago • 5 comments

configure and build works, but it can’t find socket.io.js. which isn’t surprising because it doesn’t get downloaded by npm.

$ cd "$srcdir/package"
$ sed -i 's/"make"/"make gyp"/' package.json
$ npm install -g --prefix "$pkgdir/usr"

> [email protected] preinstall /tmp/nodejs-tty-js/pkg/nodejs-tty-js/usr/lib/node_modules/tty.js
> make gyp

node-gyp configure
node-gyp build
[...]
make[1]: Leaving directory '/tmp/nodejs-tty-js/pkg/nodejs-tty-js/usr/lib/node_modules/tty.js/build'
cp -f node_modules/socket.io-client/dist/socket.io.js static/io.js
cp: der Aufruf von stat für „node_modules/socket.io-client/dist/socket.io.js“ ist nicht möglich: Datei oder Verzeichnis nicht gefunden
Makefile:6: recipe for target 'gyp' failed
make: *** [gyp] Error 1
[...]

flying-sheep avatar Nov 22 '13 13:11 flying-sheep

It could be a problem with using python3.x instead of python2.x. node-gyp relies on python to run/compile certain files. If you look at the pages for node-gyp, it says python 3.x.x is not supported.

That being said, a way to get around this would be using virtualenvwrapper or something else that changes which version of python you're using. I'll put in more information later.

shurane avatar Nov 28 '13 17:11 shurane

recommended close: on arch you can fix it by using this: export PYTHON=python2 or this: node-gyp build --python=python2 thats not so related to this project and belongs to node-gyp

GottZ avatar Sep 10 '14 12:09 GottZ

why isn’t this default behavior?

PEP 394 clearly says

  • When invoked, python2 should run some version of the Python 2 interpreter, and python3 should run some version of the Python 3 interpreter.
  • Similarly, the more general python command should be installed whenever any version of Python is installed and should invoke the same version of Python as either python2 or python3.

therefore --python=python2 is always right if the program needs Python 2, and the default behavior is a bug.

/edit: added a pull request for gyp. but it doesn’t hurt to explicitly fix this here because 1. it’ll take time until this gets pulled, put into some release, and used in all distros, and 2. the error message here doesn’t indicate that this is the cause at all.

flying-sheep avatar Sep 12 '14 17:09 flying-sheep

Well. Arch is hard to configure. People just forget to add python2 as export because you need deep knowledge of how everything works. It's not there by default because you can customize everything you want. If someone uses zsh and not bash how should the installer know where to put that export?

You are however right about that behavior.. In the past when python 3 didn't exist, /usr/bin/python would point at python 2. Now it points to one of them depending on how you configured it.

Node-gyp could just check if python2 as command exists within the path variable but thats none of tty.js business.

GottZ avatar Sep 12 '14 18:09 GottZ

i meant that we can fix this locally as well, because python2 is always right.

and export PYTHON=python2 globally isn’t right: only gyp uses that variable like this. others could want it to refer to the python3 binary.

the right thing is to call python2 if you want to use Python 2. and even if that is a gyp bug, why not force buggy software we rely on to do the right thing.

flying-sheep avatar Sep 12 '14 18:09 flying-sheep