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

Comments

Projects
None yet
4 participants
@Luanre

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

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer May 25, 2015

Contributor

Thanks. This will be fixed in the next release.

Contributor

justinbmeyer commented May 25, 2015

Thanks. This will be fixed in the next release.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer May 25, 2015

Contributor

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

require('can')
Contributor

justinbmeyer commented May 25, 2015

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

require('can')

justinbmeyer added a commit that referenced this issue May 25, 2015

@Luanre

This comment has been minimized.

Show comment
Hide comment
@Luanre

Luanre 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');

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

@daffl daffl closed this in #1712 May 25, 2015

@Bajix

This comment has been minimized.

Show comment
Hide comment
@Bajix

Bajix 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

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