Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can't install @fitbit/sdk and @fitbit/sdk-cli

ANSWERED

I have been trying to install Fitbit SDK and CLI using the below npm commands and every time it fails with error, would really appreciate if someone could provide an easy step by step installation procedure, or if I am missing something here.
npm add --dev @Fitbit/sdk
npm add --dev @Fitbit/sdk-cli

Error-
------
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path C:\Users\Ajay\Downloads\FitBit SDK\node_modules\keytar
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@18.17.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.11.4 found at "C:\Users\Ajay\AppData\Local\Programs\Python\Python311\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2019 (16.7.30611.23) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS checking VS2017 (15.9.28307.1274) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\SQL"
npm ERR! gyp ERR! find VS - "Visual Studio C++ core features" missing
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\Ajay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at C:\Users\Ajay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\Ajay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:380:14)
npm ERR! gyp ERR! stack at C:\Users\Ajay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at C:\Users\Ajay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:401:16
npm ERR! gyp ERR! stack at C:\Users\Ajay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Users\Ajay\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:427:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! System Windows_NT 10.0.22621
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Ajay\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Ajay\Downloads\FitBit SDK\node_modules\keytar
npm ERR! gyp ERR! node -v v18.17.1
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hi @AjaySingh, did you try the step-by-step method provided in the Fitbit CLI guide (https://dev.fitbit.com/getting-started/ )? I did the following steps,  and packages installed and project built without any errors.
1. Install Visual Studio Code
2. Install  Node.js Version 14
3. If creating a new project, use "npx create-fitbit-app" command. All necessary modules (including @Fitbit/sdk and @Fitbit/sdk-cli) will be installed automatically.  No need to install individual packages separately.
4. If editing from an existing project,
 (a) add the following dependency in package.json (in case of targets of Sense and Versa 3):
       "devDependencies": {
           "@fitbit/sdk": "~6.1.0",
          "@fitbit/sdk-cli": "^1.7.3"
         }
 (b) run "npm install". In this case also all necessary modules (including @Fitbit/sdk and @Fitbit/sdk-cli) will be installed automatically.
5. Now, run "npx fitbit-build" to build the project.

View best answer in original post

Best Answer
5 REPLIES 5

Hi @AjaySingh, did you try the step-by-step method provided in the Fitbit CLI guide (https://dev.fitbit.com/getting-started/ )? I did the following steps,  and packages installed and project built without any errors.
1. Install Visual Studio Code
2. Install  Node.js Version 14
3. If creating a new project, use "npx create-fitbit-app" command. All necessary modules (including @Fitbit/sdk and @Fitbit/sdk-cli) will be installed automatically.  No need to install individual packages separately.
4. If editing from an existing project,
 (a) add the following dependency in package.json (in case of targets of Sense and Versa 3):
       "devDependencies": {
           "@fitbit/sdk": "~6.1.0",
          "@fitbit/sdk-cli": "^1.7.3"
         }
 (b) run "npm install". In this case also all necessary modules (including @Fitbit/sdk and @Fitbit/sdk-cli) will be installed automatically.
5. Now, run "npx fitbit-build" to build the project.

Best Answer

As @r.b says, try node 14 (16 also works). If they don't, I have a couple of other theories.

Peter McLennan
Gondwana Software
Best Answer

I tried Node 14, but getting this error (BTW using window 11) and hence had to switch to higher Node version.
> npm install
npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ npm install
+ ~~~
+ CategoryInfo : ObjectNotFound: (npm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Best Answer
0 Votes

I also use Windows 11 without issues, so the OS version should not be a problem.  The npm command file should be located in your node.js installation folder (in my case it is "C:\Program Files\nodejs"). If this location is not in already in your system path, you may add it manually.

Best Answer

Thank you very much to all of you.

It works now, I had to uninstall everything and then started Installing from Node.js 14, and then went ahead with nvm and later ran npx install, it asked me for the nvm-window folder where I had the zip file extracted.

And it all started working now.
I will now move my old watch face script to this new SDK and see if that works.

Thanks again, appreciate everyone's help here.

Best Answer
0 Votes