grunt-s3
grunt-s3 copied to clipboard
has no method 'init'
Trying to use with Yeoman 1.0.
- Installed grunt-s3 via npm .
- Added s3 config section as per documentation.
- Registered npm task like
grunt.loadNpmTasks('grunt-s3');
.
When I run grunt s3
I get:
Loading "s3.js" tasks...ERROR
TypeError: Object #<Object> has no method 'init'
Any suggestions?
What happens when you run with grunt s3 -v --stack
?
I followed your steps but couldn't reproduce. I think @NickHeiner's suggestion is a good start.
Hi, I got the same error, here's the relevant log portion:
Registering "grunt-s3" local Npm module tasks.
Reading /Users/paulodeon/Code/project/node_modules/grunt-s3/package.json...OK
Parsing /Users/paulodeon/Code/project/node_modules/grunt-s3/package.json...OK
Loading "s3.js" tasks...ERROR
>> TypeError: Object #<Object> has no method 'init'
>> at Object.exportFn (/Users/paulodeon/Code/project/node_modules/grunt-s3/tasks/s3.js:27:11)
>> at loadTask (/Users/paulodeon/Code/project/node_modules/grunt/lib/grunt/task.js:312:10)
>> at /Users/paulodeon/Code/project/node_modules/grunt/lib/grunt/task.js:348:7
>> at Array.forEach (native)
>> at loadTasks (/Users/paulodeon/Code/project/node_modules/grunt/lib/grunt/task.js:347:11)
>> at Task.task.loadNpmTasks (/Users/paulodeon/Code/project/node_modules/grunt/lib/grunt/task.js:395:5)
>> at Object.module.exports (/Users/paulodeon/Code/project/Gruntfile.js:347:11)
>> at loadTask (/Users/paulodeon/Code/project/node_modules/grunt/lib/grunt/task.js:312:10)
>> at Task.task.init (/Users/paulodeon/Code/project/node_modules/grunt/lib/grunt/task.js:424:5)
>> at Object.grunt.tasks (/Users/paulodeon/Code/project/node_modules/grunt/lib/grunt.js:113:8)
Loading "Gruntfile.js" tasks...OK
+ build, default, server, test
@pifantastic @whyvez the issue is likely double including grunt-s3
yeoman puts this line in:
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
and then if you add:
grunt.loadNpmTasks('grunt-s3');
You'll be loading it twice. Since https://github.com/pifantastic/grunt-s3/blob/master/tasks/s3.js#L27 overwrites the s3 variable it is not idempotent and will throw the error.
Am also seeing this error when used with AngularJS. Removing the line:
grunt.loadNpmTasks('grunt-s3');
sorted the problem. Thanks @nletourneau