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

Fitbit Versa 2 development issue

ANSWERED

Hi Everyone,

 

I am testing the Fitbit CLI development, but when I try to compile a simple project, I see the following issue.

[23:21:26][error][build] package.json One or more build targets was invalid: mira
[23:21:26][error][build] package.json Error: Project configuration is invalid

 

My target is defined as:

 "buildTargets": [
      "mira"
    ],

 

and my dependencies are defined as:

"devDependencies": {
    "@fitbit/sdk": "~4.2.0",
    "@fitbit/sdk-cli": "^1.7.3"
  },

 

It seems that everything must be okay, but this error indicates that mura is not a correct buildTarget. Mura is the target for Versa2 which is the watch I want to develop applications for.

 

Have you seen such issue and how have you resolved it?

 

Thank you for your help!

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

To elaborate on Gondwana, you might have 5.0.0+ installed locally, which would give you an invalid build target -- since that is for Sense and Versa 3.
Easy mistake if you scaffold from something like "create-fitbit-app" and unknowingly updated the configuration without reinstalling dependencies.

Screenshot of error when scaffolding, and trying to build with 5+.

brh55_0-1613672425016.png

Fix it by saving your package.json, and running `npm install` .

 

Creator of Pixels on Ridge. Just building fun stuff. Check out some of my Fitbit libraries like fitbit-settings or fitbit-core to help accelerate your development.

View best answer in original post

Best Answer
0 Votes
23 REPLIES 23

Have you updated the node_modules?

Peter McLennan
Gondwana Software
Best Answer
0 Votes

To elaborate on Gondwana, you might have 5.0.0+ installed locally, which would give you an invalid build target -- since that is for Sense and Versa 3.
Easy mistake if you scaffold from something like "create-fitbit-app" and unknowingly updated the configuration without reinstalling dependencies.

Screenshot of error when scaffolding, and trying to build with 5+.

brh55_0-1613672425016.png

Fix it by saving your package.json, and running `npm install` .

 

Creator of Pixels on Ridge. Just building fun stuff. Check out some of my Fitbit libraries like fitbit-settings or fitbit-core to help accelerate your development.
Best Answer
0 Votes

I followed the instructions here https://dev.fitbit.com/build/guides/command-line-interface/
But even following it, the npm installed an app with SDK 5.0 which I changed the version manually in package.json

Using your approach brh55 it really helped me, thank you!

 

Best Answer
0 Votes

I'm having the same issue, so I ran "npm install" and had this response?

 

AnElbow_0-1683719758950.png

 

Please advise?

Best Answer
0 Votes

@AnElbowBefore running "npm install", change into the directory that contains your project's package.json file.

Peter McLennan
Gondwana Software
Best Answer

Alright, it seems I need to go back a few steps...

AnElbow_0-1683789459197.png

You can see the steps I followed here to create a test watchface.
Problem is I have a Versa 2 and it only offers me options for Versa 3 and Sense, so what I did last time is I edited the package.json to reflect my needs. Then tried to build the project and got this:

 

AnElbow_1-1683789955805.png


What I tried after reading your recommendation was I changed the directory to my app then used "npm install". I then tried to build and got this:

AnElbow_2-1683790042455.png

 


But this is all a bit ridiculous, there must be a more reasonable way of creating a project for a device other than the Versa 3 and Sense!
All the official tutorials and guides are worthless as they make absolutely no reference to this issue.

Any ideas what I am missing?

Best Answer
0 Votes

It's hard to see what's going on because the images are a bit small.

In addition to changing the build targets, did you change the SDK version to suit it?

After changing the SDK version, did you run "npm i" to adjust the node packages?

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Ah, it does appear that this forum compresses images somewhat, I didn't think it would do that. I guess I'll have to use Google Drive links in the future.

No, I didn't try "npm i" because I wasn't aware of it. Tried it and I still can't build the project because it still says that certain files are missing.

Is there a guide for developing for Versa 2? Because I feel like this whole nightmare could be avoided if the CLI allowed me to make a new clockface for the Versa 2 from the beginning, but the only options I get are Versa 3 and Sense. So I have to try to work backwards after creating the project and it's just so clumsy.

Best Answer
0 Votes

Hi @AnElbow - you need to be in the directory of your project that has the package.json, not the windows system32 directory.

 

You can click on an image and choose the size that shows in your post.

Author | ch, passion for improvement.

Best Answer

We really really really need a guide or FAQ on this topic!

 

In package.json, set "buildTargets" to suit the watch(es) on which you want your project to run. buildTarget values are as per the alias strings here. In addition, Versa 4 is "hera" and Sense 2 is "rhea", but SDKs for those devices haven't been released yet (more here).

 

Also in package.json, set "@fitbit/sdk" to an appropriate SDK version for your build targets. You can deduce the SDK broadly in terms of OS and firmware version here. In general, you should use the most recent relevant version of that SDK family, which you can determine from here. Note that the dependency in package.json should normally include a wildcard to allow more recent SDKs to be used, up to a point; eg, "~4.3.0" (details for the curious).

 

You can only specify one SDK version in package.json. This can limit the buildTargets you can easily support in any one project.

  • Versa 2 and earlier watches can only be upgraded up to SDK4.
  • Versa 3 and Sense (1) can only use SDK5 and SDK6.

SDK4 (<= Versa 2) doco can be found here.

 

The filename changes between SDK4- and SDK5+ are documented in the SDK5 announcement post in the dev blog. (Unfortunately, direct links to blog posts aren't permitted.) When going back the other way, those changes need to be reversed.

 

At the least, when changing from SDK5+ to SDK4-:

  • index.view -> index.gui
  • widget.defs -> widgets.gui
  • In widgets.gui, change /mnt/sysassets/system_widget.defs to /mnt/sysassets/widgets_common.gui

Expect other changes due to API and screen size differences.

 

In general, the Fitbit Developer Blog often contains useful information on each major SDK version release.

 

I haven't tried it, but in theory it's possible to create a new project for a specific sdk version. From the parent directory to that in which you want your new project's files, to create a new Versa 2 project called myVersa2Project, there's a chance that something like this might work:

 

  • npx create-fitbit-app myVersa2Project --sdk-version 4.3.0
Peter McLennan
Gondwana Software
Best Answer

@Gondwana  -  great post, can you add the different package.json target and dependances to make it a complete overview all in one place that people can refer to when switching between watch types, and that SDK6 is the current SDK5.

Author | ch, passion for improvement.

Best Answer

@Guy_  Thanks! 😁 I think I've made the changes you suggested (using official documentation where possible).

 

The things I do for senior Gold Community Council members... 😉

Peter McLennan
Gondwana Software
Best Answer
0 Votes

@Gondwana  - that's s really great post, that users can refer to, thank you!

Author | ch, passion for improvement.

Best Answer
0 Votes

Thank you, those changes you recommended at the beginning of your comment did allow me to move along a few more steps. I could build and install to the Fitbit OS Simulator. But alas, that document does not help as it is a tutorial for Fitbit Studio, which has been depreciated in favour of the CLI.

You are right, some real documentation would help, or at least a clear index that could lead me to it.

 

And "npx create-fitbit-app myVersa2Project --sdk-version 4.3.0" worked! THANK YOU! Your other recommendations are no longer needed after that, now I just need to figure out the easy stuff (I already have some familiarity with CSS and the rest in other contexts). 


Correction: I can now start a project in the CLI for my Versa 2, but I still need a glossary as code from guides for later products is not recognized. Any ideas where I can find one?

Best Answer

@Gondwana  Well, I figured out what I needed to through trial and error and researching JavaScript 

Here is the clockface I made,  not amazing, but I just couldn't find what I wanted in the gallery and making it myself is quite satisfying. 
I'm not going to bother making it pass review because I just wanted to personalise my own watch. Thank you for your help.

Best Answer

@AnElbow  Well done! Yes, it can be quite satisfying. The harder it is, the more satisfying it can be. 😉

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Dear @Guy_  and @Gondwana 
I am using SDK 4.3.2 and while installing the app to the simulator it prompts an error saying - 

 

 App: Error 2 Invalid path '/mnt/sysassets/widgets/text_button.gui'
[3:16:51 PM]       App: Error 22 Invalid value ''                            (mnt/sysassets/widgets/text_button.gui:1,1)
[3:16:51 PM]       App: Error 22 Could not find symbol '#text-button' in recBtn                (resources/index.gui:5,1)
[3:16:51 PM]       App: Error 22 Undefined attribute 'href' in recBtn                          (resources/index.gui:5,1)
[3:16:51 PM]       App: Error 22 Could not find symbol '#text-button' in xferBtn               (resources/index.gui:6,1)
[3:16:51 PM]       App: Error 22 Undefined attribute 'href' in xferBtn                         (resources/index.gui:6,1)

 

I am dyeing to solve this error. I have updated the node modules and all the possible solve that this community forum has discussed but failed. Any suggestions? 
Thank you so much for the help.

 


Best Answer
0 Votes

I'm stuck like everyone else. Any tips on where to get some files to copy over would help.

> fitbit-build

 

[19:48:24][error][build] package.json Display name must not be blank

[19:48:24][error][build] package.json Wipe color must be a valid hex color

[19:48:24][error][build] package.json At least one build target must be enabled

[19:48:24][warn][build] package.json Tiles available only for native components. Skipping tile configuration!

[19:48:24][error][build] package.json Error: Project configuration is invalid

Build failed with code: 1

Best Answer
0 Votes

@statsdata  How did you create the package.json file?

Peter McLennan
Gondwana Software
Best Answer