goldfire / howler.js

Javascript audio library for the modern web.
https://howlerjs.com
MIT License
23.86k stars 2.23k forks source link

Local machine build project #769

Open RDiaconeasa opened 7 years ago

RDiaconeasa commented 7 years ago

Hi,

I am new in using node and npm. I just got this project (master version) from github and i want to modify something in it and then build the minified version, but i have some problems on build.

What i did:

  1. from git CMD i've install the project dependencies using npm install
  2. Try to run npm run build, but here it throws some errors (attached is the file with the errors i get npm_build_error.txt and also the npm log 2017-05-16T06_33_21_646Z-debug.txt ).

Does anyone have any idea of which is the cause? Is something that i do wrong? Can it have something with the OS and should I try from a Linux or Mac?

PS: I was able to build other projects on my PC.

Thanks

bitbay commented 7 years ago
VERSION=`printf 'v' && node -e 'console.log(require(\"./package.json\").version)'` &&
sed -i '' '2s/.*/ *  howler.js '\"$VERSION\"'/' src/howler.core.js &&
sed -i '' '4s/.*/ *  howler.js '\"$VERSION\"'/' src/plugins/howler.spatial.js &&
uglifyjs --preamble \"/*! howler.js $VERSION | (c) 2013-2017, James Simpson of GoldFire Studios | MIT License | howlerjs.com */\" src/howler.core.js -c -m --screw-ie8 -o dist/howler.core.min.js &&
uglifyjs --preamble \"/*! howler.js $VERSION | Spatial Plugin | (c) 2013-2017, James Simpson of GoldFire Studios | MIT License | howlerjs.com */\" src/plugins/howler.spatial.js -c -m --screw-ie8 -o dist/howler.spatial.min.js &&
awk 'FNR==1{echo \"\"}1' dist/howler.core.min.js dist/howler.spatial.min.js | sed '3s~.*~/*! Spatial Plugin */~' | perl -pe 'chomp if eof' > dist/howler.min.js &&
awk '(NR>1 && FNR==1){printf (\"\\n\\n\")};1' src/howler.core.js src/plugins/howler.spatial.js > dist/howler.js

Yes, it is definitely a "windows" issue with the build commands. The bash sorcery to replace the version string with the current one from the package.json fails on windows (the first three lines above). (the lines after the two uglifyjs are maybe responsible for concating the output of uglifyjs, but not quite sure) Would recommend a rewrite to use some build tool, like gulp, for example.

In the meantime, if You don't mind using "hard-coded versions" You can build like

node node_modules\uglify-js\bin\uglifyjs --preamble "/*! howler.js v2.0.3 | (c) 2013-2017, James Simpson of GoldFire Studios | MIT License | howlerjs.com */" src/howler.core.js -c -m --screw-ie8 -o dist/howler.core.min.js

etc. (personally not tested the result though...)*

EDIT: * added

RDiaconeasa commented 7 years ago

Thanks @bitbay