Why I can't use npm packages in meteor project? - meteor

I need to add a npm package in my meteor project (for example 'moment' package). First I typed this command :
meteor npm install --save moment .
The package.json dependencies updated (moment package added), also in node_modules.
I want to use this package, so I add this line in the client side:
const moment = require('moment');
I get this message in my browser console Uncaught SyntaxError: Unexpected identifier in this line !!
Did I miss something ?

You need to do meteor npm install meteor-node-stubs --save for this to work. See Using NPM Packages in the guide.

You can only use npm packages in meteor 1.3+. For any previous versions, you will need a wrapper package or you can use meteorhacks:npm.

Related

Downgrade Firebase 9.6 to 9.2.0

What commands must I follow on the command line to downgrade. I ran uninstall and reinstalled as well as nom i -S firebase#... but now when I reload the app it just crashes.
If you have to install an older version of a package, just specify it
npm install <package>#<version>
For example: npm install firebase#9.2.0
You can also add the --save flag to that command to add it to your package.json dependencies, or --save --save-exact flags if you want that exact version specified in your package.json dependencies.
The install command is documented here: https://docs.npmjs.com/cli/install
If you're not sure what versions of a package are available, you can use:
npm view firebase versions
And npm view can be used for viewing other things about a package too.
https://docs.npmjs.com/cli/view
don't forget to remove .lock file first to rebuilt the depedency
can u give the error messege for us....

How to install latest sub-package with npm?

I know how to install latest package using npm:
npm i <package>#latest
but when the package is actually a sub-package it throws an error:
npm i #react-native-firebase/auth#latest
Error:
ENOENT: no such file or directory ...
strange enough I was not able to find something on google after hours of search.
i think when u use
npm install --save #react-native-firebase/app
its the latest version. try it and see the documentation.
rnfirebase

Install yelp package using npm in meteor

I am trying to install yelp package using npm in meteor.
The commands provided is
npm install yelp
in my config.js file
yelp = Npm.require("yelp")
But i am getting an error as
ReferenceError: module is not defined
W20151022-13:28:11.884(5.5)? (STDERR) at
app/node_modules/yelp/node_modules/oauth/lib/_utils.js:2:1
W20151022-13:28:11.884(5.5)? (STDERR) at
app/node_modules/yelp/node_modules/oauth/lib/_utils.js:6:3
Is this the right way to add npm module in meteor. Or i have to define it somewhere else? Thanks in advance.
Use this package to add npm modules to your site:
https://atmospherejs.com/meteorhacks/npm
meteor add meteorhacks:npm
And read the documentation to see how to do it. Writing npm command in the terminal won't do anything to your Meteor project.

meteor won't start becaus it is missing npm

I just checked out my meteor project from github and tried to run it, but now meteor doesn't want to start, telling me that npm is missing
I start my project as follows:
$> MONGO_URL='mongodb://localhost:27017/meteor' mrt
...
=> Started proxy.
=> Errors prevented startup:
While building the application:
error: no such package: 'npm'
=> Your application has errors. Waiting for file change.
In my project I use npm like
var fs = Npm.require('fs');
What I don't understand is why it doesn't work. I tried to install npm
$> mrt add npm
but that didn't fixed it. Any suggestions what the problem might be ?
When you run the app with meteor command it only uses the packages installed locally in the /packages folder and built-in Meteor packages. To also install the atmosphere packages, you should run the app with mrt command. Alternatively, you could run mrt install, which downloads the atmosphere packages to the /packages directory, and thus allows you to start the app with meteor.

Error with grunt (grunt-contrib)

If I want to install a package via npm globally, then I get the following error repeatedly... Has anybody an idea to solve this problem?
The short answer is don't install grunt-contrib. It used to be a small collection of tasks but as the grunt-contrib-* series grew, so did that library.
Nobody ever needs to install every grunt-contrib-* library. Instead, just install the tasks you need: npm install grunt-contrib-compress --save-dev
Otherwise, if you insist, install the peer dependency version it expects npm install grunt-contrib-compress#0.6.1 and try installing again: npm install grunt-contrib.

Resources