@rickkas7
Im trying to use the product-activate-sims.js
I got this error, do you know what it means?
FYI I’m able to successfully use the claim-and-lock.js.
module.js:538
throw err;
^
Error: Cannot find module 'nconf'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Steve\Documents\Atom Projects\product-activate-sims\config.js:6:32)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
I checked the SIM on the Product and it looks like it was added even with the above error.
Did you get an error when you did:
npm install
in the product-activate-sims directory?
nconf is only used for the optional configuration file parsing, so if you only used command line options it would probably have succeeded even if nconf didn’t load.
i didnt call that in that directory and I did run it from the cmd.
I’ll give that a try.
@rickkas7 is there a way to deactiveSIMs with your .js programs?
I wanted to claim and lock 1,000 LTE devices to my account, as I started I noticed that the associated SIMS were being activate too. I dont even have my products yet and it’ll be many months before we start to use them so I dont want to be paying for the SIMs just sitting in China right now.
Thanks!
@rickkas7 also is there an error on this?
in the Activate_sim.js file
var req = { auth:config.get(‘AUTH_TOKEN’), iccids:iccids, countryCode:country, product:productId };
Should it be set to this to match the below?
var req = { iccids:iccids, countryCode:country, product:productId, auth:config.get(‘AUTH_TOKEN’) };
From: https://github.com/particle-iot/particle-api-js/blob/dcbd8345460a36c5fcf1dde1427ce80cd43d884e/src/Particle.js#L895-L905
activateSIM({ iccid, iccids, country, promoCode, product, auth, context }) {
// promoCode is deprecated
iccids = iccids || [iccid];
const uri = product ? /v1/products/${product}/sims
: /v1/sims/${iccid}
;
const data = product ?
{ sims: iccids, country } :
{ country, promoCode, action: ‘activate’ };
const method = product ? ‘post’ : ‘put’;
return this.request({ uri, method, data, auth, context });
}
I would start with the set-sim-data-limit example because deactivating a SIM requires one SIM at a time, like setting the sim data limit.
Remove the mbLimit here:
var req = { auth:config.get('AUTH_TOKEN'), iccid:iccids[index], mbLimit:limit };
Change this to deactivateSIM:
particle.updateSIM(req).then(