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

Undefined is not a function #87

Closed
ivanjuras opened this issue Jun 25, 2015 · 8 comments
Closed

Undefined is not a function #87

ivanjuras opened this issue Jun 25, 2015 · 8 comments

Comments

@ivanjuras
Copy link

After updating node today I'm getting this error:

 TypeError: undefined is not a function

The line where the error occurs goes like this:

.pipe( critical({ ...
@bezoerb
Copy link
Collaborator

bezoerb commented Jun 25, 2015

@ivanjuras looks like you're trying to use the stream method. This one isn't shipped yet and therefore only available in the master branch of critical . Are you sure you've got the right version?

@addyosmani
Copy link
Owner

@ivanjuras Are you using stable? (0.5.7) or master? As @bezoerb notes above, we'll need to know what version you're using in order to assist further.

@ivanjuras
Copy link
Author

I'm using 0.5.7. It seems to be something with Gulp Orchestrator:

'critical' errored after 6.53 ms
[23:58:46] TypeError: undefined is not a function
at Gulp.<anonymous> (MYDIRECTORY\gulpfile.js:135:12)
at module.exports (MYDIRECTORY\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (MYDIRECTORY\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (MYDIRECTORY\node_modules\gulp\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (MYDIRECTORY\node_modules\gulp\node_modules\orchestrator\index.js:134:8)
at MYDIRECTORYnpm\node_modules\gulp\bin\gulp.js:129:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3

@bezoerb
Copy link
Collaborator

bezoerb commented Jun 25, 2015

Try with master npm install git+https://github.com/addyosmani/critical.git
stream isn't available in the stable version (0.5.7) yet.

@ivanjuras
Copy link
Author

@bezoerb Yep, it's working now. Thank you very much.

@bezoerb bezoerb closed this as completed Jun 26, 2015
@johjacb
Copy link

johjacb commented Jul 10, 2015

I'm seeing this issue now after updating to 0.6.0.

$ gulp critical
[09:39:21] Using gulpfile ~/Sites/fizz/gulpfile.js
[09:39:21] Starting 'critical'...
[09:39:21] 'critical' errored after 6.34 ms
[09:39:21] TypeError: object is not a function
    at Gulp.<anonymous> (/Users/awake/Sites/fizz/gulpfile.js:118:15)
    at module.exports (/Users/awake/Sites/fizz/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/awake/Sites/fizz/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/awake/Sites/fizz/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Users/awake/Sites/fizz/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
    at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
    at /Users/awake/Sites/fizz/node_modules/assemble/node_modules/assemble-utils/node_modules/session-cache/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3

using this bit from the docs

gulp.task('critical', function () {
    return gulp.src('builds/*.html')
        .pipe(critical({base: 'builds/', inline: true, css:['builds/styles/components.css','builds/styles/main.css']}))
        .pipe(gulp.dest('builds'));
});

@bezoerb
Copy link
Collaborator

bezoerb commented Jul 10, 2015

@johjacb do you also got this bit?
var critical = require('critical').stream;

@johjacb
Copy link

johjacb commented Jul 13, 2015

i do not - i added it in and am no longer see the error. thanks!

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

4 participants