JanHalozan / iTunesConnectAnalytics

NodeJS package for iTunes Connect app analytics API
Other
143 stars 44 forks source link

Error: Cannot find module 'request' #50

Open mica83 opened 3 years ago

mica83 commented 3 years ago

Hi people, i'm testing this module but i have some problems.

I created a new empty node project with a new file "index.js" with this boilerplate code:

var itc = require('itunesconnectanalytics');
var Itunes = itc.Itunes;
var AnalyticsQuery = itc.AnalyticsQuery;

var username = 'UNAME';
var password = 'PASS';
var appId = '12345'; //Found in My Apps -> App -> Apple ID or read below on getting the app id.

var instance = new Itunes(username, password, {
  errorCallback: function(e) {
    console.log('Error logging in: ' + e);
  },
  successCallback: function(d) {
    console.log('Logged in');
  }
});

But when i run the command node index.js i get this error:

Error: Cannot find module 'request'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)

thanks

peralmq commented 3 years ago

As a workaround, you can do npm install request.

mica83 commented 3 years ago

As a workaround, you can do npm install request.

I tried, but also after this command the problem still.

Any suggestions?

peralmq commented 3 years ago

I got the same error message as you and got it working after a separate npm install of the request package. That's all I know unfortunately. Maybe we experienced different errors but got the same error message then? On 11 Dec 2020, 10:47 +0100, Michele Cavalcanti notifications@github.com, wrote:

As a workaround, you can do npm install request. I tried, but also after this command the problem still. Any suggestions? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

mica83 commented 3 years ago

I don't know, it's strange. How did you create empty node project? I did the following steps

1) install module npm install itunesconnectanalytics 2) create empty node project with the command npm init 3) create a new file (index.js) in the project with the "usual boilerplate" code as indicated in project home 4) install dependency npm install request 5) run the code node index.js

But i have the errore indicated in the previous post

I got the same error message as you and got it working after a separate npm install of the request package. That's all I know unfortunately. Maybe we experienced different errors but got the same error message then? On 11 Dec 2020, 10:47 +0100, Michele Cavalcanti @.***>, wrote: > As a workaround, you can do npm install request. I tried, but also after this command the problem still. Any suggestions? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

peralmq commented 3 years ago

Same but 1. and 2. was swapped. Do you see the request folder under node_modules/? I.e. is the request package really there? On 11 Dec 2020, 15:33 +0100, Michele Cavalcanti notifications@github.com, wrote:

I don't know, it's strange. How did you create empty node project? I did the following steps

  1. install module npm install itunesconnectanalytics
  2. create empty node project with the command npm init
  3. create a new file (index.js) in the project with the "usual boilerplate" code as indicated in project home
  4. install dependency npm install request
  5. run the code node index.js

But i have the errore indicated in the previous post

I got the same error message as you and got it working after a separate npm install of the request package. That's all I know unfortunately. Maybe we experienced different errors but got the same error message then? … On 11 Dec 2020, 10:47 +0100, Michele Cavalcanti @.***>, wrote: > As a workaround, you can do npm install request. I tried, but also after this command the problem still. Any suggestions? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

mica83 commented 3 years ago

Yeah! with point 1 and point 2 swapped it work! Thanks man

peralmq commented 3 years ago

Woho! 😁 On 11 Dec 2020, 17:30 +0100, Michele Cavalcanti notifications@github.com, wrote:

Yeah! with point 1 and point 2 swapped it work! Thanks man — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.