Reputation: 21795
I saw:
https://groups.google.com/forum/#!topic/meteor-core/ZlPPrH7SqrE
http://guaka.org/guaka-jquery-meteor-server-side-try-var-meteor-bootstrap-requirejquery-javascript-0
How can one parse HTML server-side with Meteor?
And I have not figured out a way to include jQuery in Meteor server side. Anyone knows?
I tried:
Npm.require('jquery')
Npm.require('jQuery')
But package is not found:
# Npm.require('jquery')
►[Error][Error: Cannot find module 'jquery']
Upvotes: 2
Views: 2742
Reputation: 21795
For Meteor 1.0
Create .meteor/package.json
with:
{
"dependencies":{
"jquery": "*"
}
}
Then cd .meteor
and run npm install
to install jquery in .meteor/node_modules
.
Then you can use in server Npm.require('jquery')
.
And add node_modules
in .meteor/.gitignore
so you don't push dependencies that will be installed with npm install
.
There is a problem though, npm does not keep track versions of installed packages. To do that, run npm shrinkwrap
in .meteor
, that way, when another developer run npm install
in another machine will get the same version you installed.
Upvotes: 0
Reputation: 3048
Try using this package https://github.com/meteorhacks/npm
$: meteor add meteorhacks:npm
packages.json
specify npm package and it's version { "jquery": 2.1.1 }
Meteor.npmRequire("jquery");
$: meteor
Upvotes: 2