Installation of Natural package in meteor throws uncaught exception - meteor

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

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.

Related

Meteor. Error after update to 1.9 from 1.8.3

I updated the Meteor to 1.9 with all packages(meteor/npm). The bcrypt was already installed.
I followed and executed all migration steps. Despite that I got the follow errors:
(Important to note if I downgrade to 1.8.3 everything works fine)
What is going wrong?
W20200720-17:39:36.075(3)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20200720-17:39:36.078(3)? (STDERR) While this implementation will work correctly, it is known to be
W20200720-17:39:36.079(3)? (STDERR) approximately three times slower than the native implementation.
W20200720-17:39:36.079(3)? (STDERR) In order to use the native implementation instead, run
W20200720-17:39:36.080(3)? (STDERR)
W20200720-17:39:36.080(3)? (STDERR) meteor npm install --save bcrypt
W20200720-17:39:36.080(3)? (STDERR)
W20200720-17:39:36.081(3)? (STDERR) in the root directory of your application.
=> Exited with code: 7
=> Your application is crashing. Waiting for file change.
Start meteor all logs:
backend $ meteor
[[[[[ ~/job/meteor/backend ]]]]]
=> Started proxy.
=> Meteor 1.10.2 is available. Update this project with 'meteor update'.
WARNING: npm peer requirements (for juliancwirko:postcss) not installed:
- postcss#7.0.6 installed, postcss#^6.0.22 needed
- postcss-load-config#2.0.0 installed, postcss-load-config#^1.2.0 needed
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
=> Started MongoDB.
Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
W20200722-11:50:38.504(3)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20200722-11:50:38.538(3)? (STDERR) While this implementation will work correctly, it is known to be
W20200722-11:50:38.539(3)? (STDERR) approximately three times slower than the native implementation.
W20200722-11:50:38.539(3)? (STDERR) In order to use the native implementation instead, run
W20200722-11:50:38.539(3)? (STDERR)
W20200722-11:50:38.540(3)? (STDERR) meteor npm install --save bcrypt
W20200722-11:50:38.540(3)? (STDERR)
W20200722-11:50:38.540(3)? (STDERR) in the root directory of your application.
=> Exited with code: 7
=> Your application is crashing. Waiting for file change.

Cannot find module '#babel/runtime/helpers/builtin/objectSpread' after update meteor to 1.6.1.1

i updated my meteor project to Meteor 1.6.1.1. and i got this error message
=> Exited with code: 1
W20180403-15:33:17.531(2)? (STDERR) E:\Personnal folders\quicktext5\.meteor\local\build\programs\server\boot.js:475
W20180403-15:33:17.534(2)? (STDERR) }).run();
W20180403-15:33:17.535(2)? (STDERR) ^
W20180403-15:33:17.539(2)? (STDERR)
W20180403-15:33:17.540(2)? (STDERR) Error: Cannot find module '#babel/runtime/helpers/builtin/objectSpread'
W20180403-15:33:17.541(2)? (STDERR) at Function.Module._resolveFilename (module.js:547:15)
W20180403-15:33:17.543(2)? (STDERR) at Function.resolve (internal/module.js:18:19)
W20180403-15:33:17.547(2)? (STDERR) at Object.require (E:\Personnal folders\quicktext5\.meteor\local\build\programs\server\boot.js:288:32)
W20180403-15:33:17.548(2)? (STDERR) at makeInstallerOptions.fallback (packages\modules-runtime.js:651:18)
W20180403-15:33:17.548(2)? (STDERR) at require (packages\modules-runtime.js:244:16)
W20180403-15:33:17.549(2)? (STDERR) at livedata_connection.js (E:\Personnal folders\quicktext5\.meteor\local\build\programs\server\packages\ddp-client.js:149:45)
W20180403-15:33:17.550(2)? (STDERR) at fileEvaluate (packages\modules-runtime.js:343:9)
W20180403-15:33:17.550(2)? (STDERR) at require (packages\modules-runtime.js:238:16)
W20180403-15:33:17.551(2)? (STDERR) at namespace.js (packages/ddp-client/common/namespace.js:1:300)
W20180403-15:33:17.556(2)? (STDERR) at fileEvaluate (packages\modules-runtime.js:343:9)
i tried to delete the node_modules folder and run npm install .
I also tried to install meteor npm install --save babel-runtime
but still got the same Error
Any suggestions ?
Well since the meteor-babel npm package has been updated to version 7.0.0-beta.44, which may require updating any custom Babel plugins I have enabled in a .babelrc file, I tried to running the following command to update #babel/runtime:
meteor npm install #babel/runtime#latest
Thanks to #robfallows who answered my question in Meteor forums
https://forums.meteor.com/t/cannot-find-module-babel-runtime-helpers-builtin-objectspread-after-update-meteor-to-1-6-1-1/43034
In case someone is still having the same problem, if you are not using meteor1.7.x then the latest version of babel/runtime might not fix the error for you as it didn't fix for me, what worked however was to use.
meteor npm install babel/runtime#7.0.0-beta.55
The best option would be however to update to the latest version of Meteor but if you aren't ready use the beta version above it will fix the error.
Updated to Meteor 1.7 which identified the error, said to do this:
meteor npm install --save-exact #babel/runtime#7.0.0-beta.55
Back online!

meteor test fails with SyntaxError: Unexpected reserved word

when I run the command meteor test --driver-package practicalmeteor:mocha I get the following error:
W20170314-15:20:44.067(-4)? (STDERR) /tmp/meteor-test-runfh1j93/.meteor/local/build/programs/server/packages/znewsham_justplay-common.js:971
W20170314-15:20:44.068(-4)? (STDERR) import { Random } from 'meteor/random';
W20170314-15:20:44.068(-4)? (STDERR) ^^^^^^
W20170314-15:20:44.068(-4)? (STDERR)
W20170314-15:20:44.069(-4)? (STDERR) SyntaxError: Unexpected reserved word
W20170314-15:20:44.069(-4)? (STDERR) at Object.exports.runInThisContext (vm.js:53:16)
W20170314-15:20:44.070(-4)? (STDERR) at /tmp/meteor-test-runfh1j93/.meteor/local/build/programs/server/boot.js:289:30
W20170314-15:20:44.072(-4)? (STDERR) at Array.forEach (native)
W20170314-15:20:44.073(-4)? (STDERR) at Function._.each._.forEach (/home/danilo/.meteor/packages/meteor-tool/.1.4.2_6.wp5fef++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20170314-15:20:44.074(-4)? (STDERR) at /tmp/meteor-test-runfh1j93/.meteor/local/build/programs/server/boot.js:128:5
W20170314-15:20:44.074(-4)? (STDERR) at /tmp/meteor-test-runfh1j93/.meteor/local/build/programs/server/boot.js:344:5
W20170314-15:20:44.075(-4)? (STDERR) at Function.run (/tmp/meteor-test-runfh1j93/.meteor/local/build/programs/server/profile.js:480:12)
W20170314-15:20:44.076(-4)? (STDERR) at /tmp/meteor-test-runfh1j93/.meteor/local/build/programs/server/boot.js:343:11
I dont get this on all machines I run it on, nor does it appear when not using tests.
I've tried reinstalling node, npm, meteor, removing the node_modules and reinstalling and installing babel-present-meteor.
I've had the issue before, but it either just went away on its own, or one of the hundreds of things I tried at the time got rid of it - but I can't get it working now. Any thoughts?
meteor version is 1.4.2.6
node is v4.7.3
npm is 4.1.2
The import and export words are part of ECMAScript 2015
Can you make sure you have the ecmascript package installed?
https://docs.meteor.com/packages/ecmascript.html

Meteor package fails to import or not supporting ES6

I'm trying to convert an NPM package into a Meteor package, I forked the repo from github and made changes to it.
Now I'm trying to port it, it depends on, and uses other NPM packages.
Full stack trace for the first file throwing the SyntaxError, if I comment the import it picks a different file that also has an import statement, maths is an external NPM package defined as a requirement in my root meteor's app package.json
(STDERR) in the root directory of your application.
(STDERR) /Users/octohedron/Documents/App/.meteor/local/build/programs/server/packages/my_package.js:1924
(STDERR) import { MyClass } from 'maths/dist/edit';
(STDERR) ^^^^^^
(STDERR)
(STDERR) SyntaxError: Unexpected reserved word
(STDERR) at Object.exports.runInThisContext (vm.js:53:16)
(STDERR) at /Users/octohedron/Documents/App/.meteor/local/build/programs/server/boot.js:287:30
(STDERR) at Array.forEach (native)
(STDERR) at Function._.each._.forEach (/Users/octohedron/.meteor/packages/meteor-tool/.1.4.1_1.ge5qu0++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
(STDERR) at /Users/octohedron/Documents/App/.meteor/local/build/programs/server/boot.js:128:5
import { MyClass } from 'maths/dist/edit'; => maths is an npm package specified in my package.json at the root of my meteor project.
Do I have to manually transpile all this code to vanilla jS to be able to use it in my custom meteor package?
/client/ folder doesn't support ES6.

accounts-password from meteor breaking because of bcrypt

I am getting this error:
Error: Can't find npm module 'bcrypt'. Did you forget to call 'Npm.depends' in package.js within the 'npm-bcrypt' package?
I'm not sure what to make of it.. I am just learning meteor but I have userd accounts-password and accounts-ui before without any problems. However now its asking for dependencies. If I comment out the accounts-password page in ".meteor/packages" then the server will boot up without problems.
Has anyone had this problem before? This is the full error.
W20150602-09:54:54.633(-7)? (STDERR)
W20150602-09:54:54.635(-7)? (STDERR)
/Users/VCarlos/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245 W20150602-09:54:54.635(-7)? (STDERR) throw(ex);
W20150602-09:54:54.635(-7)? (STDERR) ^
W20150602-09:54:54.639(-7)? (STDERR) Error: Can't find npm module
'bcrypt'. Did you forget to call 'Npm.depends' in package.js within
the 'npm-bcrypt' package? W20150602-09:54:54.640(-7)? (STDERR) at
Object.Npm.require
(/Users/VCarlos/Dropbox/wdi/inslim/.meteor/local/build/programs/server/boot.js:155:17)
W20150602-09:54:54.640(-7)? (STDERR) at Package
(packages/npm-bcrypt/wrapper.js:1:1) W20150602-09:54:54.640(-7)?
(STDERR) at
/Users/VCarlos/Dropbox/wdi/inslim/.meteor/local/build/programs/server/packages/npm-bcrypt.js:21:4
W20150602-09:54:54.640(-7)? (STDERR) at
/Users/VCarlos/Dropbox/wdi/inslim/.meteor/local/build/programs/server/packages/npm-bcrypt.js:30:3
W20150602-09:54:54.641(-7)? (STDERR) at
/Users/VCarlos/Dropbox/wdi/inslim/.meteor/local/build/programs/server/boot.js:222:10
W20150602-09:54:54.641(-7)? (STDERR) at Array.forEach (native)
W20150602-09:54:54.642(-7)? (STDERR) at Function..each..forEach
(/Users/VCarlos/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11) W20150602-09:54:54.642(-7)? (STDERR) at
/Users/VCarlos/Dropbox/wdi/inslim/.meteor/local/build/programs/server/boot.js:117:5
This is happening because you create your bundle on one platform (OS X, Windows, etc) then deploy your project on another platform (different from the original).
To fix this install bcrypt in your app:
In your untarred and ungziped directory:
(cd programs/server && npm install)
cd programs/server/npm/npm-bcrypt/node_modules/
rm -rf bcrypt
npm install bcrypt
Since yours is a development mode you may have to go into .meteor/local/build to make get to the bundle directory.
Your app has a weird structure its not common to have the packages/npm-bcrypt in your app. This is a native meteor package. You may want to contact the author of the app to ask why s/he has placed this package here and if its not modified remove it so Meteor can use the native bcrypt package designed for your platform.
The accepted answer didn't work for me, but this did:
rm -rf ~/.meteor/packages/npm-bcrypt.
Then after running meteor it downloaded bcrypt again and all was fine.
I have found that many of my bugs occur when I install or uninstall packages from my project while the server is still running. Simply restarting my server fixed my bcrypt issue.

Resources