Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grunt build task failed #149

Closed
twmht opened this issue Dec 6, 2013 · 13 comments
Closed

grunt build task failed #149

twmht opened this issue Dec 6, 2013 · 13 comments

Comments

@twmht
Copy link
Contributor

twmht commented Dec 6, 2013

hi,

I clone the project and run the command grunt build to build the html files.

It gave me the following errors

....
Running "jasmine_node" task

/home/mht/learnGitBranching/node_modules/grunt/lib/util/task.js:352
          throw e;
                ^
TypeError: Cannot read property '1' of null
    at Object.<anonymous> (/home/mht/learnGitBranching/node_modules/jasmine-node/lib/jasmine-node/index.js:24:57)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (/home/mht/learnGitBranching/node_modules/grunt-browserify/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
at Object.<anonymous> (/home/mht/learnGitBranching/node_modules/grunt-jasmine-node/tasks/jasmine-node-task.js:5:21)
    at Object.thisTask.fn (/home/mht/learnGitBranching/node_modules/grunt/lib/grunt/task.js:58:16)
    at Task.<anonymous> (/home/mht/learnGitBranching/node_modules/grunt/lib/util/task.js:343:36)
    at Task.<anonymous> (/home/mht/learnGitBranching/node_modules/grunt/lib/util/task.js:319:9)
    at /home/mht/learnGitBranching/node_modules/grunt-shell/tasks/shell.js:47:4
    at ChildProcess.exithandler (child_process.js:635:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

I have installed grunt-cli (from grunt tool).

I am not sure whether or not the version of grunt triggers the errors.

Thank you!

@pcottle
Copy link
Owner

pcottle commented Dec 6, 2013

Hey man, sorry to hear you are having build errors!

What version of grunt-cli do you have? Here is mine:

[pcottle:~/Dropbox/wip/learnGitBranching:(master)]$ grunt --version
grunt v0.3.17

this version is listed inside package.json, but if you downloaded the most recent version it'll be different. you should be able to do npm install inside the root directory to download the majority of dependencies

@twmht
Copy link
Contributor Author

twmht commented Dec 7, 2013

hi,

I installed the grunt-cli by npm install -g grunt-cli.

Here is my version

mht@ubuntu:~/learnGitBranching$ grunt --version
grunt-cli v0.1.11
grunt v0.3.17

I try to use the grunt executable inside node_modules

./node_modules/grunt/bin/grunt build

but it still gave me the different build errors.

...
Running "jasmine_node" task
/home/mht/learnGitBranching/node_modules/grunt/lib/util/task.js:352
          throw e;
                     ^
TypeError: Cannot read property '1' of null
    at Object.<anonymous> (/home/mht/learnGitBranching/node_modules/jasmine-node/lib/jasmine-node/index.js:24:57)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (/home/mht/learnGitBranching/node_modules/grunt-browserify/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/mht/learnGitBranching/node_modules/grunt-jasmine-node/tasks/jasmine-node-task.js:5:21)
    at Object.thisTask.fn (/home/mht/learnGitBranching/node_modules/grunt/lib/grunt/task.js:58:16)
    at Task.<anonymous> (/home/mht/learnGitBranching/node_modules/grunt/lib/util/task.js:343:36)
    at Task.<anonymous> (/home/mht/learnGitBranching/node_modules/grunt/lib/util/task.js:319:9)
    at /home/mht/learnGitBranching/node_modules/grunt-shell/tasks/shell.js:47:4
    at ChildProcess.exithandler (child_process.js:635:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5)

I have installed all the dependencies by npm install

Did I miss something?

By the way, why don't you use the most recent version to build the project?

Thank you!

@bcbcarl
Copy link
Contributor

bcbcarl commented Dec 7, 2013

This is because jquery 1.8.3 needs grunt 0.4.*.
You can try this: npm install grunt-browserify --save-dev.
However, you will get this error: Unable to find Gruntfile.
You also have to use python <= 3.0.0 in order to run npm install.

@twmht
Copy link
Contributor Author

twmht commented Dec 7, 2013

hi,

@bcbcarl
This version of grunt-browserify needs the higher version of grunt(>=0.4.0).

I still don't know why I can not build that successfully in the initial clone.

To be honest, this is my first time to use grunt build tools.
Thank you!

@bcbcarl
Copy link
Contributor

bcbcarl commented Dec 7, 2013

@twmht, I can't build it, too. Waiting for someone to resolve this problem.

@twmht
Copy link
Contributor Author

twmht commented Dec 7, 2013

hi,

Here is my workflow

git clone [email protected]:twmht/learnGitBranching.git
cd learnGitBranching
npm install
./node_modules/grunt/bin/grunt build
#Some build errros

Please tell me if I made any mistakes:(.

Thank you!

@pcottle
Copy link
Owner

pcottle commented Dec 8, 2013

Hey everyone! Thanks of starting the discussion (and sorry I took so long to respond, Facebook holiday party was Friday and I was wiped out...)

Anyways a few top-level things:

  1. @twmht I don't use the most recent version of Grunt :( I actually started this project before the newest version came out, and they introduced a breaking change of moving the project file from grunt.js to Gruntfile.js (or whatever it is now). So unfortunately I'm stuck with half of the developers on the old version and half on the new version...
  2. That being said, the package.json should fully define the dependencies of the project, so @twmht 's workflow should totally work.

I'm guessing that maybe one of the projects I have as a ~ dependency (version around) has broken, so let me try building / installing with defined versions. It should work with a clean clone, justasec...

pcottle added a commit that referenced this issue Dec 8, 2013
@pcottle
Copy link
Owner

pcottle commented Dec 8, 2013

So unfortunately I can't repro the build errors with your workflow :( I did notice that I left some trailing whitespace in a recent commit to master which ends up triggering lint and causing the build to quit early. The application was still being generated though, was just outputting a warning.

However I never got:

Running "jasmine_node" task
/home/mht/learnGitBranching/node_modules/grunt/lib/util/task.js:352
          throw e;
                     ^
TypeError: Cannot read property '1' of null

As an error unfortunately :( Here are some ideas:

  1. The jquery I use is really really basic, basically just CSS class queries and DOM queries. So if jquery is causing an issue, you should be able to drastically lower the version number. I actually just changed the version of jquery based on @bcbcarl 's recommendation:
    7ac852d

So hopefully that helps, but since I can't repro I can't know if it fixes anything :(

  1. There might be a lot of fudging of versions going on with the ~, so try removing all of the tilde's and see if npm install + build works.

  2. I updated the README with better build instructions, so hopefully it's clearer how to use the exact version of grunt I need.

I hope that helps! I wish I was better at all this build dependency stuff, kinda embarrassing for the owner of the project to not have it nailed down. Maybe I'm better educating instead :P

@pcottle
Copy link
Owner

pcottle commented Dec 8, 2013

Anyways if anyone is brave enough to modify package.json and find a configuration that works, let me know and I'll update it right away!

pcottle added a commit that referenced this issue Dec 10, 2013
@pcottle
Copy link
Owner

pcottle commented Dec 10, 2013

@bcbcarl was brave / awesome enough to fix this (at least for him), so merging and closing! Lemme know if this doesn't fix it for the other edge cases.

We also updated the readme so you can use the npm-installed version of grunt while having a separate global one

@pcottle pcottle closed this as completed Dec 10, 2013
@pcottle
Copy link
Owner

pcottle commented Dec 22, 2013

Hey I just wanted to ping everyone here -- I moved the project onto Grunt >0.4, so there should be way less headaches from using legacy plugins :P I updated the README as well to reflect this

So if you had issues beforehand, try again!

@bcbcarl
Copy link
Contributor

bcbcarl commented Jan 2, 2014

I've tested this project today and it works! :-D

@pcottle
Copy link
Owner

pcottle commented Jan 2, 2014

Woo! Great news @bcbcarl. There were some headaches porting everything over but I'm glad it paid off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants