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

Unable to load canjs in node.js environment #1711

Closed
Luanre opened this issue May 25, 2015 · 4 comments · Fixed by #1712
Closed

Unable to load canjs in node.js environment #1711

Luanre opened this issue May 25, 2015 · 4 comments · Fixed by #1712
Milestone

Comments

@Luanre
Copy link

Luanre commented May 25, 2015

CanJS 2.2.6

I tried to load canjs using the code:

var can = require('can/dist/cjs/can');

But I've met the exception:

./node_modules/can/dist/cjs/compute/get_value_and_bind.js:23
can.__isRecordingObserves = function () {
  ^
ReferenceError: can is not defined

I've found that get_value_and_bind.js requires '../util/util.js' but doesn't save result to var can.

@justinbmeyer
Copy link
Contributor

Thanks. This will be fixed in the next release.

@justinbmeyer
Copy link
Contributor

Btw, are you using browserify? Which version? With latest, you should only have to write:

require('can')

@Luanre
Copy link
Author

Luanre commented May 25, 2015

No, I'm setting up unit-test environment to test my components' scope methods.

I used browserify before and yes, canjs could be included using:

var can = require('can');

But for plugins you still need to write:

require('can/dist/cjs/object/object');

@daffl daffl added this to the 2.2.7 milestone May 25, 2015
@Bajix
Copy link

Bajix commented Jul 30, 2015

Do you think you could supplement this with an example on how to load CanJS within NodeJS?

This isn't working for me, nor does loading it with StealJS. This issue doesn't appear resolved at the moment

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

Successfully merging a pull request may close this issue.

4 participants