Problem with using DataClient - ttn SDK for Node.js

I am using ttn SDK for Node.js with ionic and I can’t instantiate my DataClient. I have only three lines of code to initialize my AppID, AccessKey and DataClient. Here’s my code :

  public appID;
  public accessKey;
  public dataClient;
  constructor() {
    this.appID = 'testloraensim';
    this.accessKey = 'ttn-account-v2.X6p1l86GfOADdPjJGypivnh0p12szzJ4rTVIh-nWsV0';
    this.dataClient = new DataClient(this.appID, this.accessKey, 'eu.thethings.network:1883');
  }

And when I compile I get an error that repeats itself many times :

[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream.ts]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream.tsx]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream.mjs]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream.js]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\grpc\src\node_modules]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\node_modules]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\node_modules]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\node_modules]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\node_modules]
[C:\Users\cecil\Documents\5A\Projet 5A\node_modules]
[C:\Users\cecil\Documents\5A\node_modules]
[C:\Users\cecil\Documents\node_modules]
[C:\Users\cecil\node_modules]
[C:\Users\node_modules]
[C:\node_modules]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\grpc\node_modules\stream]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\grpc\node_modules\stream.ts]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream.ts]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\grpc\node_modules\stream.tsx]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream.tsx]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\grpc\node_modules\stream.mjs]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream.mjs]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\grpc\node_modules\stream.js]
[C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream.js]
 @ ./node_modules/grpc/src/client.js 46:13-30
 @ ./node_modules/grpc/index.js
 @ ./node_modules/ttn/dist/applications/applications.js
 @ ./node_modules/ttn/dist/applications/index.js
 @ ./node_modules/ttn/dist/index.js
 @ ./src/app/tab2/tab2.page.ts
 @ ./src/app/tab2/tab2.module.ts
 @ ./src/app/tabs/tabs-routing.module.ts
 @ ./src/app/tabs/tabs.module.ts
 @ ./src/app/app-routing.module.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts
ERROR in ./node_modules/jws/lib/data-stream.js
Module not found: Error: Can't resolve 'stream' in 'C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\jws\lib'
resolve 'stream' in 'C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\jws\lib'
  Parsed request is a module
  using description file: C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\jws\package.json (relative path: ./lib)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      looking for modules in C:/Users/cecil/Documents/5A/Projet 5A/Git/Application/Application/photo-gallery/
        using description file: C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\package.json (relative path: .)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\package.json (relative path: ./stream)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream.js doesn't exist
            as directory
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\stream doesn't exist
      C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\jws\lib\node_modules doesn't exist or is not a directory
      C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\jws\node_modules doesn't exist or is not a directory
      C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\node_modules doesn't exist or is not a directory
      C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\node_modules doesn't exist or is not a directory
      C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\node_modules doesn't exist or is not a directory
      C:\Users\cecil\Documents\5A\Projet 5A\Git\node_modules doesn't exist or is not a directory
      C:\Users\cecil\Documents\5A\Projet 5A\node_modules doesn't exist or is not a directory
      C:\Users\cecil\Documents\5A\node_modules doesn't exist or is not a directory
      C:\Users\cecil\Documents\node_modules doesn't exist or is not a directory
      C:\Users\cecil\node_modules doesn't exist or is not a directory
      C:\Users\node_modules doesn't exist or is not a directory
      C:\node_modules doesn't exist or is not a directory
      looking for modules in C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules
        using description file: C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
          using description file: C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\package.json (relative path: ./node_modules/stream)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream.tsx doesn't exist
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream.js doesn't exist
            as directory
              C:\Users\cecil\Documents\5A\Projet 5A\Git\Application\Application\photo-gallery\node_modules\stream doesn't exist

Does any of you have experienced with this ?

Thanks

no need to use the data-client constructor
see this reference we can do all think for data-client related event
please refer this link understand it ->
https://www.thethingsnetwork.org/docs/applications/nodejs/quick-start.html

Note that most/all SDKs have been deprecated in December 2019. See its README, and, e.g.,

1 Like

is there any alternatives to these sdk we could use now?

The MQTT & HTTP api’s can be easily implemented in most modern languages. Not sure if FORTRAN has a curl option, but pretty much everything else does.