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

Node.js installed but will not run anything...

ANSWERED

Anyone been able to get CLI working?  I followed the Guide here: https://dev.fitbit.com/build/guides/command-line-interface/ installed Node.js and Visual Studio Code and can't get anything to create or import just error messages all over the place.  Love Studio and don't want to have to switch but am willing to switch if I can get this thing working.  Any Help?  I have searched Google and no one has an actual guide for how to get this thing working.fitbitCLI.PNG

Best Answer
1 BEST ANSWER

Accepted Solutions

Can't explain why but maybe it will work for others as well.  I can't run any of the npx or npm command successfully in either Command Prompt or Node.js Command Prompt.  While working on workflows with the new applications I found if I run the commands from the Terminal window of Visual Studio Code they all run fine.  Good luck to everyone making the transition to CLI.

This is for a computer running Windows 10

  • Install Visual Studio Code as well, runs way faster than Visual Studio 2022 for editing your files, same link as above.
  • Open a New Terminal window in VS Code run the following commands should create a node_modules folder along with 2 files package.json and package-lock.json files in the default directory typically C:\users\Username just check what folder your cmd window is at.
  • Export your project from Studio
  • Copy the files from the exported zip files into a new folder
  • Copy the node_modules folder and the package-lock.json file into the applications directory you just created for the export files.
  • Update the package.json file in your exported directory with the following dependencies.
"devDependencies": {
       "@fitbit/sdk": "~6.1.0",
       "@fitbit/sdk-cli": "~1.7.3"},
  • Open a New Terminal window in VS Code and change directory to the application folder.
  • You should now be able to run npx fitbit-build
    • this command will create a build folder in your application directory.  There you will find the app.fba needed to upload your application to the Gallery App Manager.
  • You should now be able to run npx fitbit and login to your fitbit account.
  • Launch the Fitbit OS Simulator app
  • Once logged in from fitbit$ you should now be able to run npx install and have it install the app to your Fitbit OS Simulator for testing.

To create a new project from an existing project.

  • Copy the existing project files into a new folder.
  • Open New Terminal window in VS Code and change directory to the new folder.
  • Run npx fitbit-build generate-appid
  • Edit package.json with new application name.
  • Edit resources and other files to match new application.
  • Run npx fitbit-build to create the new build folder and app.fba file.
  • Follow steps above to install it to the Simulator and test.

View best answer in original post

Best Answer
3 REPLIES 3

Can't explain why but maybe it will work for others as well.  I can't run any of the npx or npm command successfully in either Command Prompt or Node.js Command Prompt.  While working on workflows with the new applications I found if I run the commands from the Terminal window of Visual Studio Code they all run fine.  Good luck to everyone making the transition to CLI.

This is for a computer running Windows 10

  • Install Visual Studio Code as well, runs way faster than Visual Studio 2022 for editing your files, same link as above.
  • Open a New Terminal window in VS Code run the following commands should create a node_modules folder along with 2 files package.json and package-lock.json files in the default directory typically C:\users\Username just check what folder your cmd window is at.
  • Export your project from Studio
  • Copy the files from the exported zip files into a new folder
  • Copy the node_modules folder and the package-lock.json file into the applications directory you just created for the export files.
  • Update the package.json file in your exported directory with the following dependencies.
"devDependencies": {
       "@fitbit/sdk": "~6.1.0",
       "@fitbit/sdk-cli": "~1.7.3"},
  • Open a New Terminal window in VS Code and change directory to the application folder.
  • You should now be able to run npx fitbit-build
    • this command will create a build folder in your application directory.  There you will find the app.fba needed to upload your application to the Gallery App Manager.
  • You should now be able to run npx fitbit and login to your fitbit account.
  • Launch the Fitbit OS Simulator app
  • Once logged in from fitbit$ you should now be able to run npx install and have it install the app to your Fitbit OS Simulator for testing.

To create a new project from an existing project.

  • Copy the existing project files into a new folder.
  • Open New Terminal window in VS Code and change directory to the new folder.
  • Run npx fitbit-build generate-appid
  • Edit package.json with new application name.
  • Edit resources and other files to match new application.
  • Run npx fitbit-build to create the new build folder and app.fba file.
  • Follow steps above to install it to the Simulator and test.
Best Answer

Can't explain why but maybe it will work for others as well.  I can't run any of the npx or npm command successfully in either Command Prompt or Node.js Command Prompt.  While working on workflows with the new applications I found if I run the commands from the Terminal window of Visual Studio Code they all run fine.  Good luck to everyone making the transition to CLI.  I updated the post above with the steps to use Terminal windows in VS Code.

Best Answer

Hi @4IsDesign - thanks for taking the time to provide helpful guidance for CLI.

Author | ch, passion for improvement.

Best Answer
0 Votes