assets-packager icon indicating copy to clipboard operation
assets-packager copied to clipboard

Cannot assetspkg on examples

Open anguyen8 opened this issue 12 years ago • 14 comments

I got this error while trying out on the /examples folder. Same problem on Win7 / Linux.

/usr/local/lib/node_modules/assets-packager/node_modules/assets-expander/lib/assets.js:12 throw new AssetsExpander.YamlSyntaxError(e.toString()); ^ YamlSyntaxError: TypeError: Cannot read property '1' of undefined at Object.AssetsExpander (/usr/local/lib/node_modules/assets-packager/node_modules/assets-expander/lib/assets.js:12:11) at Object. (/usr/local/lib/node_modules/assets-packager/bin/assetspkg:102:16) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9)

anguyen8 avatar Aug 13 '12 18:08 anguyen8

Thanks @tot2ivn for reporting this issue. We refactored the whole project recently to get rid of platform compatibility issues like YAML parsing so it's interesting to see such a problem pops up. Can you confirm you have the most recent version checked out (I assume you do) and that you didn't make any changes to examples/assets.yml? Also which version of node do you run?

Jakub Pawlowicz

GoalSmashers avatar Aug 13 '12 18:08 GoalSmashers

Hi Jakub,

Here is how to reproduce the problem:

  1. I git clone assets-packager. Git version of project downloaded is: f2399a4
  2. I make no modifications to any files and jump directly to /examples folder and try out the code : assetspkg -c assets.yml -g

Baam, error shows like above.

*The node I'm running on Win7/Linux is both v0.8.2

Thanks for looking into this :)

anguyen8 avatar Aug 13 '12 19:08 anguyen8

It seems it's not a problem with node itself as here it runs fine on 0.8.2. Is it possible that you have an older version of assetspkg on your system already installed via npm? If so then 'assetspkg -c assets.yml -g' will use the global one instead of local one. You can verify it via assetspkg -v (the newest one is 0.7.0).

If you do then try running ../bin/assetspkg -c assets.yml -g instead in /examples.

GoalSmashers avatar Aug 13 '12 19:08 GoalSmashers

@tot2ivn did you manage to find out what was wrong with running the example?

GoalSmashers avatar Aug 16 '12 13:08 GoalSmashers

My global installed assetspkg is actually v0.7.0 ..but it still didn't work. If I try running ../bin/assetspkg -c assets.yml -g , then there is a more obvious error:

Error: Cannot find module 'uglify-js' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:362:17) at require (module.js:378:17) at Object. (/media/projects/node-apps/assets-packager/bin/assetspkg:7:12) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10)

I didn't have time to look into this, so still now sure what's wrong.

anguyen8 avatar Aug 16 '12 19:08 anguyen8

Could you then try one more thing then - please run npm install in project's root directory and then ../bin/assetspkg -c assets.yml -g under examples. Wild guess tells me it should work that way.

GoalSmashers avatar Aug 16 '12 19:08 GoalSmashers

Ah npm install installs all the packages; however, it still does not work, and shows the same error as when using the globally installed assets-packager..

anguyen8 avatar Aug 16 '12 22:08 anguyen8

I'm totally puzzled over this bug, especially since it occurs on both Linux and Win 7. I'll try to find the reason and will get back to you.

On 17 sie 2012, at 00:53, Totti Anh Nguyen [email protected] wrote:

Ah javascript npm install installs all the packages; however, it still does not work, and shows the same error as when using the globally installed assets-packager..

— Reply to this email directly or view it on GitHub.

GoalSmashers avatar Aug 16 '12 23:08 GoalSmashers

Hi @tot2ivn,

Sorry for not getting back to you earlier on. Would it be possible for you to check if it's still reproducible if you:

  1. Fetch assets-packager by downloading zipped source (ZIP icon) and unpack it.
  2. Run npm install in downloaded folder.
  3. Run ../bin/assetspkg -c assets.yml in the download's examples directory.

It seems to us git could be blamed for this error but we are still not sure.

Thank you for your time! Jakub

GoalSmashers avatar Aug 27 '12 08:08 GoalSmashers

Hello @GoalSmashers ! Not sure, that it's still actual. I tried your last solution (on win 8). It still not working. On step 3 I got: '..\bin\assetspkg' is not recognized as an internal or external command,operable program or batch file. Replaced with node ..\bin..., then got error: F:\akepath\assets-packager-master\node_modules\assets-expander\lib\assets.j s:12 throw new AssetsExpander.YamlSyntaxError(e.toString()); ^ YamlSyntaxError: SyntaxError: near " application: 'reset,gr" at Object.AssetsExpander (F:\akepath\assets-packager-master\node_module s\assets-expander\lib\assets.js:12:11) at new Packager (F:\akepath\assets-packager-master\lib\packager.js:17:1 8) at Object. (F:\akepath\assets-packager-master\bin\assetspkg: 87:1) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3 Checked existing YAML using http://yaml-online-parser.appspot.com/ - this validator. It gave me output: { "stylesheets": { "application": "reset,grid,base,application" }, "javascripts": { "application": [ "application,helpers", "vendor/jquery" ] } } I played with *NIX - Win style line endings in .yml without any luck When I trying to use globally installed module I get totally the same error as described in this issue. P.S. If you need me to test - just ask. I liked this module by it's description and it would be great to have it working :)

m-teslya avatar Feb 21 '14 01:02 m-teslya

Hi @m-teslya. Let me check it for you today when I can get my hands on a Win machine.

GoalSmashers avatar Feb 21 '14 07:02 GoalSmashers

So far no luck reproducing this issue. It's been bothering people before as well.

Do you check it out with git or GitHub for Windows? And what shell do you use?

GoalSmashers avatar Feb 21 '14 22:02 GoalSmashers

Do you check it out with git or GitHub for Windows? No, as recommended, I got code using "Download zip" button And what shell do you use? cmd.exe, standard Windows command processor When installing globally, I used command npm install -g assets-packager

m-teslya avatar Feb 22 '14 10:02 m-teslya

@m-teslya it appears to be a problem with "Download zip" functionality as it gives incorrect line endings in YAML files.

Can you give it a try via GitHub for Windows?

GoalSmashers avatar Feb 22 '14 11:02 GoalSmashers