Open ishoax opened 5 years ago
@ishoax, Could you provide details about what platform you're running on - OS X/Windows version? Also, are you using a node version manager? (could it be the same as this issue? https://github.com/pixijs/pixi-animate-extension/issues/54)
My OS X is High Sierra Version 10.13.6. No I am not using node version manager to my knowledge. The 'nvm' command is not found when I check in my terminal. My node version is v11.14.0 and my npm version is v6.9.0. My co-worker who was also trying to use the plugin the same day has OS X Mojave, and he does have an NVM installed on his Mac. However, he was receiving the same results on his machine where no JS file was being created.
Assuming you're not seeing Electron launch (and/or hang), and also not seeing any error message, we recently saw an issue like this where /usr/local/bin/electron
existed, but it was not an actual sym-link to the globally-installed node_modules/electron/cli.js
. That would be an area to check.
i recreated the symlink (electron was installed with nvm and in my nvm folder) and it doesn't lauch. I get a json file, but no js available for instantiating the library
I'm getting the same issue as ericente and bdanis... any update on this? If there is no fix for this, since I am getting a json file (which is really, the critical part), how might I go about parsing that json file into something PIXIJS can use and render into a DisplayObject?
Thank you!
There was something in the process of parsing the json to a js file that was crashing. It was an npm setup issue on my computer. I had to remake symlinks in the proper paths. It required some electron debugging and command line launch of the process. Sorry. It’s been a while and i cant remember what i did exactly
I remember in my case Electron wasn't running and I believe we had to create a symlink so that it would run. Sorry I don't remember the exact command as we fixed it offline in person instead of via slack so I don't have a record saved
Thank you both for your help! I finally got it sorted. :-)
I was quite puzzled because, even though I had created a symlink in
/usr/local/bin
to point to the corresponding electron module inside my ~/.nvm directory, and despite the fact that I could launch electron on the command line, the plugin would create only part of the necessary files (i.e. no <project_name>.js
file), as you both experienced.
Both your posts gave me the clue that even though Electron might still be correctly referenced in the system $PATH, it may be failing silently partway through the publish process.
Just to be safe that it didn't have anything to do with nvm, I deleted my ~/.nvm directory and commented out the corresponding lines that load it, in my ~/.bash_profile, and re-installed a fresh copy of node from a binary distribution, directly from the nodejs.org website.
This was to ensure that all node files would be directly installed in the /usr/local/bin
(as it turns out, however, this was not the issue).
The first clue came when I tried to install Electron globally (this time, however, I installed it with the --verbose flag).
npm install -g electron --verbose
And I saw that it was failing to write to the node_modules file.
I checked the directory write permissions, but I confirmed that they were correctly set to 755.
(More head-scratching)
But then I noticed that the node_modules folder was owned by root:wheel instead of ${username}:admin
, like other directories in that folder. I therefore went and manually changed the owner of all the files and directories therein (such as npm and electron) to be owned by ${username}:admin
and voila! Problem solved!
The lesson learned is to always install npm packages with the --verbose
flag, since it provides vital clues to errors during the installation process that may silently fail and might otherwise go unnoticed.
Thanks again for taking the time to reply, I doubt I would have figured it out without your valuable hints!
Great job!
Glad you got this sorted out. For reference of anyone else who runs into this issue, commonly caused by NVM or other node version managers, as well as by Node being installed through Homebrew.
If you get a JSON file output instead of JS, (and individual images instead of spritesheets, if that setting is enabled), that usually means that Electron was unable to launch at all. Usually errors within the Electron process are shown in an alert popup.
Currently, on a Mac, this plugin launches Electron via this command: /usr/local/bin/node /usr/local/bin/electron
. If you run that line in Terminal, and Electron does not launch, the plugin will not work correctly. Putting symlinks in those locations for Node and/or Electron (whichever is missing) should resolve the issue.
I didn't write the original code for this plugin, so I'm not sure if there's a reason that line hard-coded the paths for Node and Electron, but I suspect that it could be re-written to just depend on whatever Electron/Node is installed globally and accessible in the PATH. It appears that the Windows version works fine just depending on electron
being able to run in cmd.exe. I'll look into making Mac also just depend on electron
being able to launch from Terminal, as this seems to be a common issue.
The reason it was implemented that way (hard-coded absolute path) was because we don't have access to the PATH
environmental variable from process that are spawned from Animate. It's kind of a bummer, because it would me much nicer to just call electron
.
I made a simple animation of a box moving across the canvas for testing out pixi-animate but when publishing from Animate CC (I tried both Animate CC 2018 and 2019) I'm not receiving a JavaScript file for the animation data. I seem to be getting everything else such as an HTML, JSON, images folder with images, and a libs folder with pixi/pixi-animate JS files. The HTML file tries to load the JS file
<script src="box.js"></script>
and then use itscene.load(lib.box);
but its not getting created when published. Any thoughts or help is appreciated.