Knowledge Base

Module 5 (Building a Custom Integration): Error installing TTN SDK

Hello everyone,

After finally resolving my connectivity issues, I've moved on to creating a custom integration. However, I'm stuck trying to install the TTN SDK via the Node.js command line. The instructions for the portion I'm stuck on are below.

"Start listening to events
To listen to events on The Things Network, we will use The Things Network application SDK.

First, install the SDK using npm:

$ npm install --save ttn
This will download ttn and add it (thanks to the --save option) to the list of dependencies of your project in package.json."

Essentially, I'm getting several errors when I try to install the TTN SDK, and I'm not sure how to interpret or resolve the errors that I'm receiving. These errors are indicated below:

server.jsconsole.log("Starting server...")

ReferenceError: server is not defined
at Object. (C:\Users\MyName\server\server.js:1:1)
[90m at Module._compile (internal/modules/cjs/loader.js:776:30)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:643:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:556:12)[39m
[90m at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)[39m
[90m at internal/main/run_main_module.js:17:11[39m

C:\Users\MyName\server>npm install --save ttn
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:

Any help would be greatly appreciated!!!

First issue: There is a "new line" display issue with our new website for all code blocks.
You should put the following code in the file "server.js"
// server.js
console.log("Starting server...")
So running "node server.js" will now work and return "Starting server..."

Second issue: It seems that git is not installed or not in the path. What is your operating system ? See git documentation: