3

I am wanting to try out the Lungo.js examples from here : https://github.com/tapquo/Lungo.js, however the index.html in the example directory is expecting files in the components and package directories and, while those directories do exist as part of this bundle, they are empty of any files.

I have a GruntFile.coffee and a package.json and I believe that together these are some kind of make file that perhaps should make/pull/create the files that the example needs to run, but I don't know how to make them do that.

I have installed the following:

sudo npm install -g grunt-cli

sudo npm install -g grunt

sudo npm install -g coffee-script

I can now run "coffee GruntFile.coffee" successfully, but it does nothing I can see, certainly it is not creating the missing files.

And the "grunt" command simply says "Fatal error: Unable to find local grunt."


How do I tell this bundle of code that I have to get the other files I require?

And, bonus question, what's going on here? (I understand javascript, and pulling code from github, but not these other frameworks)

kris
  • 11,868
  • 9
  • 88
  • 110

2 Answers2

3

package.json has devDependencies field. They need to be installed before you may use grunt command. First you need execute

npm install

in directory wich contains it.

There is definitely bug in this line of Gruntfile

You should change it to:

pkg: grunt.file.readJSON "package.json"

Then, after local grunt is installed, you may run

grunt

which will execute default task. This is well known practice last time.

Andrew Shustariov
  • 2,530
  • 1
  • 17
  • 17
  • Awesome answer - thank you - I am getting there. (Thank you also @Anzeo for your answer pointing out about the grunt install needing to be local and explaining how to do that) My next issue is an "Aborted due to warnings." due to "Stylus failed to compile." I've tried npm install stylus (and with -g) which does not effect this - perhaps it is an issue in the .styl file? I'll post the warning text in the next comment. – kris Jan 09 '14 at 05:28
  • Running "stylus:core" (stylus) task >> Error: src/stylesheets/__init.styl:1 >> > 1| \@import "CSSmethods/vendor.styl" >> 2| >> 3| /* CONSTANTS */ >> 4| HEADER_HEIGHT = 46px >> >> failed to locate @import file CSSmethods/vendor.styl Warning: Stylus failed to compile. Use --force to continue. Aborted due to warnings. – kris Jan 09 '14 at 05:28
  • I've resolved this stylus error by adding an empty vendor.styl file (based on the name I assume it's for my own custom CSS anyway so this is a correct solution). There is another stylus error that comes up now with lungo.widget.pull.styl ('unexpected "indent"') - I've spent some time trying to debug this, it looks like stylus doesn't like the square bracket CSS selectors?? I'm going to leave it at that for now I think. Thanks again - really impressed with your answer. – kris Jan 09 '14 at 06:06
1

You need to install grunt locally, not globally. Only grunt-cli should be installed globally.

So instead of

npm install -g grunt

Navigate to your project root folder and execute

npm install grunt

There's a getting started guide on the Grunt homepage.

The package.json file is a descriptor file for your application. More information on this file can be found in this interactive guide. You normally use grunt together with this file so you can list your grunt plugins as dependencies of your application. I suggest reading a tutorial on grunt to learn how it works.

thomaux
  • 19,133
  • 10
  • 76
  • 103
  • With such approach, you will have to install each dependency, specified in package.json, manually. – Andrew Shustariov Jan 07 '14 at 09:53
  • No. You can stil use `npm install` to install all packages listed in it. I'm pointing out that the OP should install grunt locally and not globally. It's also related to the issue he's getting. – thomaux Jan 07 '14 at 10:01
  • I didn't say, that this changes how npm work. I said, that this won't solve problem. Look at [Gruntfile](https://github.com/tapquo/Lungo.js/blob/master/GruntFile.coffee#L101) see those calls to loadNpmTask? Those tasks should be installed to via npm install task_name, before call to grunt. – Andrew Shustariov Jan 07 '14 at 10:06
  • The error the OP's getting clearly states there's no local grunt installed. As I don't know what's inside the package.json, but I do know that he installed grunt globally I'm pretty sure this does answer the OP's question. – thomaux Jan 07 '14 at 10:08
  • Just cloned repository and tried your approach. As I said, after fixing package reference, error about not installed npm modules (which all specified in [package.json](https://github.com/tapquo/Lungo.js/blob/master/package.json#L9)) raised – Andrew Shustariov Jan 07 '14 at 10:18