Need some help importing NPM - beginner

Hello guys.
I have just started to learn meteor and javascript as well.
I wanted to make an app for my photon project so i have a clear goal that makes this fun :slight_smile:

However i have some issues, the particle requires a NPM package as you can see here

When i looking around on the forum it appears meteor will not be able to handle this as of 1.3, so when will 1.3 be released you think? I guess i can start with the beta but then i come to another issue, knowledge :slight_smile:

Is there any tutorials out there that explain how to import NPM package in meteor, i cant seem to find any one, remember im new to this.

Have anyone used this particle-api.js and can share some how to or example code that they written in meteor, so i have something to study to understand how it works?


You can have a look at my GitHub repository, AnnotatedJS/meteor-react-start-app as an example of importing NPM modules . It is (currently) still up and running at And some basic tutorials at

Thank you for the answer, I have started to update my meteor and we see how long i can come with the help of your tutorial.


Not sure your steps works?

I followed them several time also checked the

But after i run
meteor create --release 1.3-beta.12 myapp - completes fine
cd myapp - completes fine

Then i run rm -rf * and i get error ‘rm’ is not recognized as an internal or external command,
operable program or batch file.

also if i try to run npm init -f i get error ‘npm’ is not recognized as an internal or external command,
operable program or batch file.

What do i do wrong? i have installed node.js but i might need some setup?
i run windows 10.


Solved it by an article on windows 10 and npm, i cant add more links as a new user so cant post it :frowning:
But its solved for me now atleast.



Is your app utilizing Particle.getEventStream()? The recent depreciation of sparkjs broke my app. I think I’m going to have to use Particle.getVariable() in conjunction with setTimeout() until I can get a (lot) better understanding of promises.

Hello myramanes.

I im a total beginner im affraid so i have not been able to start with particle.api.js yet.
Still learning meteor and material design before i start with particle.

I guess i am the one that will ask you questions when i get there :slight_smile:

Sorry im not able to help.


Hello myramanes.

Have you been able to get your code to work?
Is there a chance that you can share your code, the part where you are asking for particle events?
i found myself to be able to understand better if i actually see working code and follow the flow.

There are not so many examples out there for particle-api-js that can help a beginner :slight_smile:

i found a meteor particle skeleton on github but that was for the old spark, i was able to get it to work
but the particle-api-js is very different.

Anyway, i will do my best to get this to work but if you have already managed ? :slight_smile:


So, here’s my “playground” for trying to accomplish my goal of being able to call meteor methods from within particle-api-js getEventStream() using 1.2…

if (Meteor.isServer) {
    var Particle = Meteor.npmRequire('particle-api-js');
    var particle = new Particle();

    var particleLogin = particle.login({
        username: 'USERNAME',
        password: 'PASSWORD'

    particleLogin.then(function (data) {
        return data.body.access_token;
    }).then(function (token) {
        return particle.getEventStream({
            deviceId: 'DEVICE_ID',
            auth: token
    }).then(function (stream) {
        stream.on('event', function (data) {
            var eventString = + ": " +;

The console.log() works, but I get an error whenever I try to call a meteor method or insert into a mongo db.

I had a working example using spark, but it quit working in the past week - “An error occurred while getting core attrs: [Error: invalid_token]”

Hello Myramanes.

I have been on a google tour and have found some people that have made projects with particle-api-js.
Its not examples but completed project and since i am not a coder just a person with visions that needs a simple app
im affraid i dont understand everything with it.

Here are some links, maybe you can understand everything with it.

I will try to see if i can get something going on with this data
but i would like to ask if you can get it to work i need help with the following.

In the HTML file i want to have a login that log me in to the particle cloud, when im logged in i want
to receive all events in to my mongo database where is store them and show them on a event view.
I also want the eventview to collect new events and update the view if its happen while i look at it.

The most important for me is that when i get a new event i get a notification on my phone so i know that is has happened.

In the end this will be a mobile app that will only show events and notify me about it, i will not control anything with it.

When i have done all that i will also try to write a tutorial of it so new people like me don’t have to struggle so much.
i think with this as a starter me and others will be able to continue to work with all the other feature the api has.

What do you think, do we have a starter point here :slight_smile: ?


1 Like

I found a little time today and tested your example and some others.
I wonder if the issue you encounter is this the following

XMLHttpRequest cannot load A wildcard ‘*’ cannot be used in the ‘Access-Control-Allow-Origin’ header when the credentials flag is true. Origin ‘http://localhost:3000’ is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.

If i check the consol of chrome i get that error.
Firefox also gives error but not so detailed.

Im at lost on how to fix it thou. I will ask the question on the community site and see what they say.



I might have done some progress today, somehow i thought about writing the code on the server side
if (Meteor.isServer) { // Server Logic}

i tested the login example and got a success back :slight_smile:
not been able to do anymore but a little exited that it might work now.


Just realised you are in the server :frowning: so i Will continue to test under the weekend.