Installing natural package in a meteor application - meteor

For having natural language processing facility. Have added natural node package in my application using "npm install natural". But after installation while running the application using "sudo meteor", got some error about ""ReferenceError: require is not defined"". After googling found that need to do following steps:
1) Remove node_modules on the top of the root of the application (Done this part)
2) Added "natural": "0.1.27" in packages.json file also
3) Install npm using ""mrt add npm"". But getting following error after installing it in the application, while using ""sudo meteor"".
=> Meteor 0.8.1.3 is available. Update this project with 'meteor update'.
Initializing mongo database... this may take a moment.
npm ERR! missing: rimraf#2.x, required by meteor-npm#0.1.10
npm ERR! missing: mkdirp#0.3.x, required by meteor-npm#0.1.10
npm ERR! not ok code 0
=> Errors prevented startup:
While building package router:
error: no such package: 'ui'
While building package npm:
error: couldn't read npm version lock information
=> Your application has errors. Waiting for file change.
Any pointers what should be done. Not getting anything, this error taking my whole time. Thanks in advance

To use NPM packages within your meteor application you need to first install meteor-npm
mrt add npm
You then have to add a packages.json file at the root of your project like so;
{
"natural": "0.1.27"
}
When this file changes, meteor will automatically update its dependencies.
You can then use var natural = Meteor.require("natural")

Related

Cannot download "https://github.com/sass/node- sass/releases/download/v4.5.2/darwin-x64-57_binding.node" error. What does this mean?

I've created used Meteor to create an APP that communicates with some hardware through MQTT using Mosquitto. It was done on a Linux computer and everyone went fine. Now I've loaded the files onto OSX and I'm getting the following error with it. I've tried updates sass to the latest verson and then redoing npm install, but to no avail.
=> A patch (Meteor 1.7.0.5) for your current release is available!
Update this project now with 'meteor update --patch'.
Errors prevented startup:
While loading package materialize:materialize#0.100.2:
error: Command failed: /Users/random/.meteor/packages/meteor- tool/.1.7.0_4.x53m8m.ifru9++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm rebuild --update-binary
Cannot download "https://github.com/sass/node- sass/releases/download/v4.5.2/darwin-x64-57_binding.node": HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
I have found a solution.
Remove the node_modules folder
Remove the package-lock.json file
Clear npm cache with
npm cache clean
Install the last version
npm install node-sass#latest
npm rebuild node-sass
Modify package.json from your project to new version of node-sass
Run
npm i
If you have another dependency that use node-sass change her version
Remove package-lock.json then npm install, again. Worked for me.
(No need to remove node modules)

Meteor 1.7 bundler is broken

I am trying to deploy an app that has been upgraded to meteor 1.7 using the setup for passenger outlined at puhsionpasserger.com, however when I try and access the app I get an error in the console of
Error: The core-js npm package could not be found in your node_modules directory. Please run the following command to install it: meteor npm install --save core-js
Being shown on the web page (although the favercon is correct so its trying).
The app runs fine locally (as in on the dev machine).
Give its deployed, meteor doesn't exist on the machine.
I tried npm install --save core.js and it reported one package installed, but still no joy on the app front.
I'm not sure where to go from here. Any thoughts?
Edit:
I just tried building the app without the --server-only flag with no change. Deployed the app the way I do with the v1.3 instances of the app and no change.
One thing that I did get when running npm intall from the /programs/server directory was
Binary is fine; exiting
npm WARN lifecycle meteor-dev-bundle#~install: cannot run in wd %s %s (wd=%s) meteor-dev-bundle# node npm-rebuild.js /opt/bundle/programs/server
added 131 packages in 13.857s
I'm not sure if the warning means anything in particular.

How to use NPM and install packages inside Visual Studio 2017?

I have a simple Visual Studio solution, running ASP.NET Core v2 and building a React app.
Now, I want to install a simple component using the NPM. In this particular example, it could be:
npm install --save react-bootstrap-typeahead
I want this package to work just in my solution and nowhere else.
My result:
When I run this, I get the following nice error which obviously makes some sense. If NPM believes it can find my project file at 'C:\Users\LarsHoldgaard\package.json', it's out of luck. The correct path would be C:\Users\LarsHoldgaard\Documents\Github\Likvido.CreditRisk\Likvido.CreditRisk\Likvido.CreditRisk .
npm : npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\LarsHoldgaard\package.json'
At line:1 char:1
+ npm install --save react-bootstrap-typeahead
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (npm WARN saveEr...d\package.json':String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
npm
WARN
enoent
ENOENT: no such file or directory, open 'C:\Users\LarsHoldgaard\package.json'
npm
WARN
grunt-sass#2.0.0 requires a peer of grunt#>=0.4.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
react-rating#1.0.6 requires a peer of react#>=0.13.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
react-bootstrap-typeahead#2.5.1 requires a peer of react#^0.14.0 || ^15.2.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
react-bootstrap-typeahead#2.5.1 requires a peer of react-dom#^0.14.0 || ^15.2.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
prop-types-extra#1.0.1 requires a peer of react#>=0.14.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
react-overlays#0.8.3 requires a peer of react#^0.14.9 || >=15.3.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
react-overlays#0.8.3 requires a peer of react-dom#^0.14.9 || >=15.3.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
react-onclickoutside#6.7.1 requires a peer of react#^15.5.x || ^16.x but none is installed. You must install peer dependencies yourself.
npm
WARN
react-onclickoutside#6.7.1 requires a peer of react-dom#^15.5.x || ^16.x but none is installed. You must install peer dependencies yourself.
npm
WARN
react-transition-group#2.2.1 requires a peer of react#>=15.0.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
react-transition-group#2.2.1 requires a peer of react-dom#>=15.0.0 but none is installed. You must install peer dependencies yourself.
npm
WARN
LarsHoldgaard No description
npm
WARN
LarsHoldgaard No repository field.
npm
WARN
LarsHoldgaard No README data
npm
WARN
LarsHoldgaard No license field.
My thinking:
Being a console noob, I would guess I just needed to change my current folder. But if I run dir, I am in the right folder, and I can see my package.json along with other files.
What is the right way to install components?
To avoid navigating manually to the correct directory use the "Open Command Line" extension from Mads Kristensen. It is available for free in the Marketplace. You find it here.
Once installed you can open a command prompt conviently directly from within Visual Studio.
Tipp: Use the Keyboard Shortcut ALT+Space instead of the context menu to open the command prompt.
You can then run your npm command:
npm install react-bootstrap-typeahead
As a side note: As of npm 5.0.0, installed modules are added as a dependency by default, so the --save option is no longer required.
Update 2019:
Developer Command Prompt and Developer Power Shell are now integrated into Visual Studio 2019 ( 16.2 Preview 2 ) - no need for an extension anymore.
You find them under Tools/Command Line
By default no shortcut is assigned - so you have to do this yourself.
I think the easiest way is to simple use the UI, Visual Studio provides.
Create in the root of your project a package.json (Todo so, right click your project, add item and search for NPM. You will find a npm Configuration File):
{
"name": "SomeName",
"version": "1.0.0",
"private": true,
"devDependencies": {
"react-bootstrap-typeahead": "*"
}
}
Note that * is for the latest version. This is not recommended. Better to specify the version you want. You will notice, that you have support of intellisence for versions and package names.
Everytime you make changes to the json file, simple press CTRL + S. Visual Studio automaticly calls NPM and restores the packages.
For how to use the command line, other have already answerd. But as being a command line noob myself, I prefer this way.
You can use the Package Manager Console to run npm command.
To open the Package Manager Console, go to Tools > Nuget Package Manager and select Package Manager Console and then enter your npm command.
Update:
The latest visual studio 16.8.3 onwards, you will find the terminal built into visual studio.
You can find it by right-clicking at your solution or a shortcut Ctrl + `:
In Window's Explorer, navigate to where the package.json file is located in your project.
Create a folder named node_modules in the same directory as your package.json file
While holding the left [Shift] key, right click in the folder containing the project.json file.
From the context menu select 'Open command window here'.
Input your npm command npm install --save react-bootstrap-typeahead
I use a different approach, configuring npm per SOLUTION, instead of per PROJECT.
Please refer to my BLOG:
A better way to use Visual Studio with npm ( and Gulp )
It is working fine and you may use Command Line ou Package Manager Console do install/update/uninstall npm packages.
I am currently using it with Visual Studio 2019 and ASP.NET Core MVC.
Adding my 2 cents from 2021.
Visual Studio comes with built-in npm support, no CLI required. VS can automatically install/restore packages in the background - on project open and/or after making changes to packages.json file. You can enable this here:
For example, here's an article about configuring automatic minification and compilation for js/css files via npm tool, using just naked Visual Studio (DISCLAIMER: I wrote that blog post myself last year)

Meteor 1.3 node build: doesn't work anymore with React

With 1.2.*, I used to build my staging/production bundles with meteor build, then moving into ./bundle/programs/server and npm install there.
I do the same thing with 1.3 version but now I have error message on trying to run bundle main file with node:
WARNING: npm peer requirements not installed:
- react#0.14.x not installed.
- react-addons-pure-render-mixin#0.14.x not installed.
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
/var/www/builds/1459320997/bundle/programs/server/node_modules/fibers/future.js:267
throw(ex);
^
Error: Can't find npm module 'react'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?
I use react-meteor-data meteor package.
However, I already have "react": "^0.14.8", and "react-addons-linked-state-mixin": "^0.14.8", in my package.json and of course installed it with npm install ... --save and it is working fine on development environment when I use meteor command.
Any additional actions needed to run it? Did they change how meteor package should be build for production and didn't changed their docs? (because I don't see any changes in docs concerning meteor build so far.
Update: I tried to manually npm install these packages into ./bundle/program/server. Now they consequentially requires packages already listed in my package.json. I suppose Meteor just ignore this file on bundle. Will try to add a bug in their tracker.
I used Meteor 1.2 to build new 1.3 code so it is the issue. It happened because currently I build on the server that had another Meteor version.
I used answer from another Stackoverflow user (Ian) Updating all Meteor packages to latest versions
Easiest way is to delete the contents of .meteor/versions and then save

Trying to run Meteor after updating to 0.9.0 and getting error: Error: failed to connect to [127.0.0.1:3001]

I've been trying to get my app working after upgrading to 0.9.0 and I have been experiencing weird issues.
First I cloned my repository onto this computer which was at 0.8.3 Then When I ran Meteor update I got error:
Can't contact the update server. Are you online?
This project is already at Meteor 0.8.3, the latest release
installed on this computer.
So I following the instructions here: Can't install, update or run Meteor after update
But even after that I got the same error. So then I just changed the release version number in the .meteor folder to 0.9.0 and ran meteor update and it update the app.
Then I ran mrt migrate-app, and migrated all the packages successfully.
Now when I run 'Meteor' I get this error:
Ferozes-iMac:Bookmarks Feroze$ meteor
[[[[[ ~/Desktop/Meteor_Bookmark/Bookmarks ]]]]]
=> Started proxy.
=> Starting MongoDB... |
/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:206
throw(ex);
^
Error: failed to connect to [127.0.0.1:3001]
at Object.Future.wait (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:326:15)
at Object.exports.waitForOne (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/fiber-helpers.js:53:25)
at yieldingMethod (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-mongo.js:209:25)
at initiateReplSetAndWaitForReady (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-mongo.js:382:7)
at launchMongo (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-mongo.js:494:9)
at _.extend._startOrRestart (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-mongo.js:581:19)
at _.extend.start (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-mongo.js:547:10)
at _.extend.start (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-all.js:130:24)
at Object.exports.run (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/run-all.js:275:10)
at main.registerCommand.name [as func] (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/commands.js:219:17)
at /Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/main.js:1212:23
- - - - -
at null.<anonymous> (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/unipackages/mongo-livedata/npm/node_modules/mongodb/lib/mongodb/connection/server.js:536:74)
at emit (events.js:106:17)
at null.<anonymous> (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/unipackages/mongo-livedata/npm/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:150:15)
at emit (events.js:98:17)
at Socket.<anonymous> (/Users/Feroze/.meteor/packages/meteor-tool/.1.0.25.1761nat++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/unipackages/mongo-livedata/npm/node_modules/mongodb/lib/mongodb/connection/connection.js:516:10)
at Socket.emit (events.js:95:17)
at net.js:440:14
at process._tickCallback (node.js:419:13)
Appreciate the help
UPDATE
To help debug, I create a new user account, installed meteor, cloned my project. And then ran meteor update. And this is what I get:
Ferozes-iMac:Bookmarks Nearpoint$ meteor update
Installing Meteor 0.9.0.1:
* 'meteor' build tool (version 8301fde275)
Figuring out the best package versions to use. This may take a moment.
Figuring out the best package versions to use. This may take a moment.
Figuring out the best package versions to use. This may take a moment.
Figuring out the best package versions to use. This may take a moment.
Figuring out the best package versions to use. This may take a moment.
Figuring out the best package versions to use. This may take a moment.
This project is at the latest release which is compatible with your
current package constraints.
That isn't normal, it should ask me to migrate the app?
Here is my packages file:
# Meteor packages used by this project, one per line.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
standard-app-packages
npm
iron-router
spin
jade
coffeescript
stylus
bootstrap-3
font-awesome
accounts-password
jquery-ui
select2
jquery-masonry
accounts-ui-bootstrap-3
bootstrap-errors
http
moment
accounts-google
jquery
bootstrap3-datetimepicker
filepicker
meds
kadira
jquery-ui-bootstrap
flash-messages
Here is smart.json
{
"packages": {
"iron-router": {
"version": "0.8.2"
},
"spin": {},
"jade": {},
"font-awesome": {},
"jquery-ui": {},
"bootstrap-3": {},
"select2": {},
"jquery-masonry": {},
"accounts-ui-bootstrap-3": {},
"bootstrap-errors": {},
"moment": {},
"bootstrap3-datetimepicker": {},
"filepicker": {},
"meds": {},
"kadira": {},
"jquery-ui-bootstrap": {},
"flash-messages": {}
}
}
Try replacing
iron-router
with
iron:router#0.9.1
in your packages file.
Here is what I ended up doing to get it working.
Starting off with a working Meteor app at version 0.8.3,
1) I first manually changed the release file version to 0.9.0 as simply running 'meteor update' did not work to update meteor to 0.9.0.
2) After manually changing the release file number to 0.9.0 then run 'meteor update'
3) After meteor updates, make sure you update meteorite with
npm install -g meteorite
or if you need sudo access
sudo -H npm install -g meteorite
4) After meteorite successfully updates then run 'mrt migrate-app'. Work out any bugs it may report. My app had packages that were incompatible with the migration so I had to remove them from the smart.json file first and then run 'mrt migrate-app' again. Run the command until is sucessfully completes.
5) Then run 'meteor' and the server should start. It might still complain about incompatible packages. You should check atmosphere package website for package that are working with 0.9.0 and install those and remove any packages meteor complains about.
This is how I got my app working on 0.9.0

Resources