TannerRogalsky / punchdrunk

An attempt to replicate the LÖVE API in the browser using moonshine.
http://tannerrogalsky.com/punchdrunk/
MIT License
81 stars 10 forks source link

Error running "distil game" task #50

Closed bayrock closed 10 years ago

bayrock commented 10 years ago

I finally got everything setup correctly (I think) but when I try running grunt I get an error:

Running "coffee:app" (coffee) task

Running "concat:punchdrunk" (concat) task
File "js/punchdrunk.js" created.

Running "distil_game" task
Fatal error: Path must be a string without null bytes.

Sorry if this is obvious but what path must I change in order to fix this?

TannerRogalsky commented 10 years ago

I'm not sure what that error is, actually. Can you run grunt --stack and paste the output here? Also, what platform are you on and how did you install node and Lua?

bayrock commented 10 years ago

I'm using my Ubuntu 14.04 server without a GUI.

I installed Lua like this: sudo apt-get install lua5.2 and did nothing else in particular

Node was a pain for me to install properly and I ended up needing to symlink the node folder to nodejs so grunt would work, and then in the project folder I had to install multiple modules manually that it was unable to locate. Once I installed them manually grunt was not returning any errors except for the distil_game error.

Here's what happens if I run grunt --stack in my project folder:

$ grunt --stack
Running "coffee:app" (coffee) task
Warning: Unable to write "js/love.js" file (Error code: EACCES). Use --force to continue.
Error: EACCES, permission denied 'js/love.js'
  at Object.fs.openSync (fs.js:432:18)
  at Object.fs.writeFileSync (fs.js:971:15)
  at Object.file.write (/home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt/lib/grunt/file.js:296:10)
  at writeFile (/home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt-contrib-coffee/tasks/coffee.js:224:18)
  at /home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt-contrib-coffee/tasks/coffee.js:36:9
  at Array.forEach (native)
  at Object.<anonymous> (/home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt-contrib-coffee/tasks/coffee.js:27:16)
  at Object.<anonymous> (/home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt/lib/grunt/task.js:264:15)
  at Object.thisTask.fn (/home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt/lib/grunt/task.js:82:16)
  at Object.<anonymous> (/home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt/lib/util/task.js:301:30)
  at Task.runTaskFn (/home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt/lib/util/task.js:251:24)
  at Task.<anonymous> (/home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt/lib/util/task.js:300:12)
  at /home/devinity/websites/devinity.org/public_html/bayrock/node_modules/grunt/lib/util/task.js:227:11
  at process._tickCallback (node.js:419:13)
  at Function.Module.runMain (module.js:499:11)
  at startup (node.js:119:16)
  at node.js:906:3

Aborted due to warnings.

Apparently it's "unable to write 'js/love.js'" file but do you have any idea why? I've read something about changing the Lua path so if that could be the answer then I'd appreciate instruction on that.

I'll admit I'm not very familiar with installing things on my Linux server yet but I'm sure I installed NodeJS, NPM, grunt, Lua, and top level dependencies.

TannerRogalsky commented 10 years ago

Yeah, your file permissions are not allowing node to write files to your working directory. You need to use chmod to give whatever user node is running under (probably yours) write access to that directory. http://www.linux.com/learn/tutorials/309527-understanding-linux-file-permissions

bayrock commented 10 years ago

I tried giving read and write access to user, group, and other on the directory where I have punchdrunk but I still get the same error. @TannerRogalsky

Any suggestions? I'd love to get this working.

bayrock commented 10 years ago

@TannerRogalsky

Still unable to figure out what's wrong. I tried setting the read, write, and execute permissions on my user and my root for the directory where punchdrunk is located.

Is that what I'm meant to be doing? Or is there another directory I need to change?

As stated I'd love to get this working but so far it's been a pain.

TannerRogalsky commented 10 years ago

I've done some research and I think I may have tracked down the source of your issue. gamesys/moonshine#5 has the same error as you originally did. It seems that moonshine only works with lua5.1 as of now. Here's what I think you should try: uninstall lua5.2, install lua5.1 (http://packages.ubuntu.com/trusty/lua5.1), try grunt. That might fix it. If it doesn't, you might need to modify moonshine a little.

https://github.com/gamesys/moonshine/blob/0d96c75747cb962aa330f2d1a68f6640f641ec68/bin/commands/distil.js#L152

You may need to change that line from exec('luac -o ' to exec('luac51 -o ' or maybe exec('luac5.1 -o '. That file should be (relative to punchdrunk's root level) at ./node_modules/moonshine/bin/commands/distil.js. Let me know if that helps!

bayrock commented 10 years ago

I greatly appreciate your assistance and the information!

After uninstalling Lua 5.2 and replacing it with Lua 5.1 it changed my error to this upon running grunt:

Running "coffee:app" (coffee) task

Running "concat:punchdrunk" (concat) task
File "js/punchdrunk.js" created.

Running "distil_game" task
Luac compile error in file cannot open lua/conf.lua.moonshine.luac on line Permission denied
:
        undefined
File written: lua/main.lua.json

After doing sudo chown -R to make sure my user owned the directory the error was fixed!

After that grunt continuously returned npm connect module errors. Running npm install connect did not seem to fix it but installing the modules individually one by one like npm install negotiator helped return this outcome:

Running "coffee:app" (coffee) task

Running "concat:punchdrunk" (concat) task
File "js/punchdrunk.js" created.

Running "distil_game" task
File written: lua/conf.lua.json
File written: lua/main.lua.json

Running "distil_bootstrap" task
File written: js/boot.lua.json

Running "distil_examples" task
File written: examples/touch/main.lua.json
File written: examples/iyfct/tunnel.lua.json
File written: examples/rolling_hills/main.lua.json
File written: examples/iyfct/train.lua.json
File written: examples/iyfct/table-save.lua.json
File written: examples/iyfct/terrain.lua.json
File written: examples/iyfct/player.lua.json
File written: examples/iyfct/menu.lua.json
File written: examples/iyfct/gorge.lua.json
File written: examples/iyfct/main.lua.json
File written: examples/iyfct/conf.lua.json
File written: examples/iyfct/cloud.lua.json
File written: examples/iyfct/bird.lua.json
File written: examples/cube/main.lua.json
File written: examples/falling_blocks/main.lua.json
File written: examples/arcs/main.lua.json
File written: examples/trails/main.lua.json

Running "connect:server" (connect) task
Started connect web server on http://0.0.0.0:8000

Running "watch" task
Waiting...http://0.0.0.0:8000

http://Devinity.org/bayrock/projects/moody.html

It seems I now have punchdrunk running on my webserver, and only because of you @TannerRogalsky for your great work and support. Thanks to you I'll be able to share my first application project with others without having them download a questionable executable.

On another note do you have any idea why it made me install the npm modules manually? If I was more familiar with Linux I might know but we only switched from Windows server recently so thanks for baring with me.

TannerRogalsky commented 10 years ago

Nice! I'm glad we got that sorted out.

Regarding the npm issue: I'm not sure why just running npm install wouldn't install all the dependencies but just using npm install connect without specifying a version probably wouldn't work because the version that you would install would be different from the one specified in package.json.

Anyway, I appreciate you being a bit of a guinea pig here. I'm going to start filling out the wiki with troubleshooting tips soon and your experience will be helpful there. Thanks!

bayrock commented 10 years ago

No problem at all.

I'm really liking punchdrunk so far. It already has much of the functionality I needed, and I can see you're actively developing it so keep up the awesome work! Meanwhile I'll be glad to follow the project.

paulcuth commented 9 years ago

I've now added a configuration option to the Moonshine distillery so that you can set which compiler it uses. If I understand your setup correctly, you should now be able to add compiler: "luac51" to the distil.parseCommand calls in Gruntfile.coffee.

bayrock commented 9 years ago

Thanks for the update @paulcuth.

Went back and fenced my previous grunt logs in code blocks for readability in case my situation may be useful to others in the future. Cheers.