mapbox / carto

fast CSS-like map stylesheets
https://cartocss.readthedocs.io/
Apache License 2.0
652 stars 129 forks source link

Installation fails on vanilla Ubuntu 16.04.2 LTS #468

Closed SomeoneElseOSM closed 7 years ago

SomeoneElseOSM commented 7 years ago

(logged here as requested by https://github.com/gravitystorm/openstreetmap-carto/issues/2576#issuecomment-283178632 )

sudo apt install npm sudo npm install -g carto

npm ERR! Linux 4.4.0-64-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "carto" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn

npm ERR! mapnik-reference@8.6.1 postinstall: node generate.js npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the mapnik-reference@8.6.1 postinstall script 'node generate.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the mapnik-reference package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node generate.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs mapnik-reference npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls mapnik-reference npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /home/renderaccount/npm-debug.log npm ERR! code 1

For info /home/renderaccount/npm-debug.log is 10k lines long and 847k in size; does that need to be added here too?

nebulon42 commented 7 years ago

Thanks, this is actually a problem with mapnik-reference. I have seen this sporadically, but am not sure why it sometimes does not work. I think carto may still work correctly if npm installed it despite this error.

Tracked in https://github.com/mapnik/mapnik-reference/issues/133.

springmeyer commented 7 years ago

@nebulon42 I think the problem may be the order that different npm versions execute hook like preinstall and postinstall. I've seen preinstall usage with node-pre-gyp work 99% of the time - it seems, and failures increase on windows and with node via stock ubuntu. This is somewhat captured at https://github.com/mapbox/node-pre-gyp/issues/260.

Take home: I don't know what exactly is wrong, but I sense that staying away from preinstall and postinstall in npm is advisable. I recall working with you to settle on postinstall.... hmmm

nebulon42 commented 7 years ago

@SomeoneElseOSM A workaround for the problem is to install the package nodejs-legacy. This enables the Node.js binary under node which should make the error go away.

nebulon42 commented 7 years ago

ref https://github.com/mapnik/mapnik-reference/pull/137

nebulon42 commented 7 years ago

This is now fixed by v0.18.1

SomeoneElseOSM commented 7 years ago

Exactly the same problem still seems to be present. If I do:

sudo apt install npm sudo npm install -g carto

and run "carto -v" I get: carto 0.9.5 (Carto map stylesheet compiler) (that's the version from the Ubuntu repository)

Also if I do:

sudo apt install nodejs-legacy sudo npm install -g carto

and run "carto -v" I get: carto 0.9.5 (Carto map stylesheet compiler)

To be clear - the title of this bug is "Installation fails on vanilla Ubuntu 16.04.2 LTS". To fix it, I'd expect some information about how to make installation not fail on a vanilla Ubuntu 16.04.2 LTS, and I'd expect that information to be contained in https://github.com/mapbox/carto/blob/master/README.md which still just says "npm install -g carto".

nebulon42 commented 7 years ago

You really should remove the hopelessly outdated 0.9.5 version by uninstalling the node-carto package and then try again.

Also please post the NPM output again. Which version of carto is installed by doing npm install -g carto? Is it 0.18.1? If so, then the problem should be fixed. Otherwise there is still work to do and I will reopen this issue.

SomeoneElseOSM commented 7 years ago

Thanks - when I "dpkg -r node-carto", "carto -v" suggests that 0.18.1 is installed (and it can process the latest osm-carto's .mml file). I'll try it again "soup to nuts" and check that it all works.

Edit: It works!