priya
priya

Reputation: 91

Installation of Natural package in meteor throws uncaught exception

I am working on a project based on meteor framework. For natural language facility, have installed natural package using "npm install natural" command. For this, have used following link "https://github.com/NaturalNode/natural".

When I run the app,it is throwing the following error

--

W20140521-14:22:08.096(1)? (STDERR) /home/priya/.meteor/tools/09b63f1ed5/lib/node_modules/fibers/future.js:173 W20140521-14:22:08.385(1)? (STDERR) throw(ex); W20140521-14:22:08.386(1)? (STDERR) ^ W20140521-14:22:08.386(1)? (STDERR) ReferenceError: require is not defined W20140521-14:22:08.387(1)? (STDERR) at app/node_modules/natural/node_modules/apparatus/lib/apparatus/classifier/bayes_classifier.js:23:12 W20140521-14:22:08.387(1)? (STDERR) at app/node_modules/natural/node_modules/apparatus/lib/apparatus/classifier/bayes_classifier.js:134:3 W20140521-14:22:08.387(1)? (STDERR) at /home/priya/gbproject/.meteor/local/build/programs/server/boot.js:155:10 W20140521-14:22:08.388(1)? (STDERR) at Array.forEach (native) W20140521-14:22:08.388(1)? (STDERR) at Function..each..forEach (/home/priya/.meteor/tools/09b63f1ed5/lib/node_modules/underscore/underscore.js:79:11) W20140521-14:22:08.388(1)? (STDERR) at /home/priya/gbproject/.meteor/local/build/programs/server/boot.js:82:5 => Exited with code: 8

-- I have not written any code after it's installation, then why showing this error. Googled also but could not get the solution. Any pointers please. Thanks in advance

Upvotes: 0

Views: 157

Answers (1)

Julien Le Coupanec
Julien Le Coupanec

Reputation: 7998

0: Remove the "node_modules" directory at the root of your application if it exists (it should be created when you run npm install natural).

1: If you need to install a NPM package with Meteor, I recommend you add the NPM package with mrt:

mrt add npm

2: Then, you should add your npm package inside the packages.json file (created during step 1 at the root of your application).

{
    "natural": "0.1.27",
}

3: Then, use Meteor.require('natural')in your file instead of NPM.require('natural').

4: Launch Meteor and check that everything works as expected.

Upvotes: 2

Related Questions