tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.22k stars 290 forks source link

`npm start` fails on windows #569

Closed meetar closed 7 years ago

meetar commented 7 years ago

Using git bash on Windows 10, npm start returns:

npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tangram@0.12.5 watch script '$(npm bin)/budo src/module.js:dist/tangram.debug.js --port 8000 --cors --live -- -t [ babelify --presets [ es2015 ] ] -t brfs -s Tangram -p [ './build/quine.js' 'tangram.debug.temp.js.map' ] -p [ mapstraction 'dist/tangram.debug.temp.js.map' ]'.
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 tangram package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     $(npm bin)/budo src/module.js:dist/tangram.debug.js --port 8000 --cors --live -- -t [ babelify --presets [ es2015 ] ] -t brfs -s Tangram -p [ './build/quine.js' 'tangram.debug.temp.js.map' ] -p [ mapstraction 'dist/tangram.debug.temp.js.map' ]

However, copying and pasting that literal command works:

$ $(npm bin)/budo src/module.js:dist/tangram.debug.js --port 8000 --cors --live -- -t [ babelify --presets [ es2015 ] ] -t brfs -s Tangram -p [ './build/quine.js' 'tangram.debug.temp.js.map' ] -p [ mapstraction 'dist/tangram.debug.temp.js.map' ]
[0012] info  Server running at http://169.254.68.54:8000/ (connect)
[0012] info  LiveReload running on 35729
[0086] 1m 13.6s    1.6MB (browserify)

The problem seems to be the way environment variables are referenced from within unix and windows shells. In this case, when npm start runs it starts a subprocess which uses a Windows shell, which expects the %NAME% pattern, so $(npm bin) can't resolve.

I don't know if there's a way control what kind of shell is used for a subprocesses in a cross-platform script. See https://www.npmjs.com/package/cross-env for more on this.

meetar commented 7 years ago

Fixed by https://github.com/tangrams/tangram/pull/617