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

What alternative to CLI?

After spending several days battling with installing Node,js unsuccessfully, on a dedicated Windows 10 PC, which loaded so many modules and dependencies and always fails to run completely, is there any alternative to simply compile an app's js code?

 

It seems like a very overly complex installation with so many prerequisites to just build a pseudo code fba file required by the watch or Simulator, that perhaps there is a simpler way?

 

There doesn't seem much point spending so much time to write or support programs for older watches and not be able to develop for the new watches either.

 

Does anyone know of a simpler way to support existing clocks and apps and develop new ones, which works ?

Author | ch, passion for improvement.

Best Answer
0 Votes
13 REPLIES 13

Hi @Guy_ , did you install node version 14.17.3 (other versions seem not to work for fitbit) through nvm? On my Windows 11 pc I initially installed this version directly, but could not run fitbit CLI. Then I uninstalled it, and reinstalled the same version through nvm, and then it worked! I don't know why, but may be the node installations are somehow different when directly installed and when installed through nvm.

Best Answer
0 Votes

Thanks so much @r.b - effectively after s system restore node 14.7.3 seems to install and was even able to use npx fitbit-build on a project that had the node modules in it's directory and the package-lock,json, and get an fba file for a Versa.

 

However copying the node modules and the package-lock,json into another project directory also worked for a Versa but not a Sense [adjusting SDK 4.3.0 to 6.0.0 and meson to atlas] - the project was working fine in Studio so everything was correct, except the SDK and watch name.

 

Any ideas?

 

npx install fails

npx create-fitbit-app my-first-clock [it reinstalls the @fitbit/sdk and @fitbit/sdk-cli although already installed] then fails

 

Possibly it needs Python, but cant find the reference for installing it manually.

 

Having to copy the node modules and package-lock,json to every project directory seems like a real waste of space.

 

The whole CLI thing is so temperamental and poorly documented. Such a complete waste of time.

 

Thank you for your good help, at least it's possible to build all my projects for a Versa !!, even if the FBA can't be sideloaded [not working anymore] or installed in the Simulator or the watch because that part does not work. Private link seems to be the only option.

Author | ch, passion for improvement.

Best Answer
0 Votes

I don't think npx install is a thing. Try npm i. It has to be run from the directory containing package.json, but you probably know that.

 

When changing build targets and SDK version, npm i (or equivalent) is necessary because the contents of node_modules tends to be specific to a target and SDK. For this reason, copying the folder isn't recommended — although it can be useful to save a bit of internet bandwidth. When in doubt, delete node_modules and run npm i to get a clean version from scratch.

 

I'm no node expert, but I don't think I'd be copying package-lock.json around. That file might prevent npm i from installing the versions of packages that are needed for a particular build.

 

Python is necessary if keytar needs to be built for your environment. It doesn't sound like that's the problem, although you didn't provide enough details to be sure.

 

There are alternatives to npm that can keep packages in a central location rather than duplicating them for every project. However, I wouldn't dabble with the extra complication of that until you've got npm mastered.

 

Sideloading from CLI works fine for me. What are you doing, and what are you seeing, when you try it?

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Never copy the node_modules folder to a different project. Just run `npm install` from inside a project folder which contains the package.json file.

 

When the install runs it downloads the correct modules and dependencies for the SDK and CLI versions which are mentioned in the package.json file.

Best Answer
0 Votes

Thanks @JonFitbit for the tip, but this means each project has to have around 18,000 Node module files totaling 160 MB for projects sharing SDK 4 and SDK 6 in the same folder which plays havoc on disk storage and backups.

 

For over 50 projects, the total is over 900,000 files and nearly 8 GB of mostly duplicated storage, which will go into the File History as well, which is an horrendous waste of space and time to generate and maintain.

 

If projects for SDK 4 and SDK 6 are developed in separate folders those figures are virtually doubled to 1,5 million files and 12 GB of storage.

 

Isn't there a better way ?

 

That is if you can even get it to work!!

Author | ch, passion for improvement.

Best Answer
0 Votes

Yes, you can share the folder, but only if the package.json file has the exact same dependencies. e.g. same SDK version and CLI version

Best Answer
0 Votes

@JonFitbit- that would help a lot, where do you tell the project to find the shared folder?

 

Basically would need only two such folders in which case for SDK 4.3 and 6.1. Exceptions could dealt with separately.

Author | ch, passion for improvement.

Best Answer
0 Votes

You could create a symlink in the current project to point to your master node_modules folder. 

https://www.howtogeek.com/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/

Best Answer

I'm not sure that the typescript transpiler handles symlinks properly (at least on Windows). I've had more success using alternatives to npm (such as yarn and pnpm).

 

HOWEVER, my strong recommendation is to get CLI working properly with npm first, before adding additional layers of complication.

Peter McLennan
Gondwana Software
Best Answer

Thanks @Gondwana - am trying to get CLI working with npm but after installing Node.js [which works] nearly every command fails for one reason or another, too many to list here.

 

It seems impossible to get it working, even for an IT person.

 

@JonFitbit- Could it be that it just won't work on 32 bit Windows 10 Home?

 

 

Author | ch, passion for improvement.

Best Answer
0 Votes

For any serious developers with 50 projects or more, after some measurements please note that the disk requirements are revised upwards to potentially install 1.5 million Node module files requiring 12 GB of disk space for Node alone, if SDK 4 and SDK 6 are in separate folders.

Author | ch, passion for improvement.

Best Answer
0 Votes

@JonFitbit- "When the install runs it downloads the correct modules and dependencies for the SDK and CLI versions which are mentioned in the package.json file." 
I have to wholeheartedly disagree with this statement. I have been trying to update an existing project for weeks and npm install throws two errors. One for  Got allows a redirect to a UNIX socket and one for glob-parent before 5.1.2 vulnerable to Regular Expression. Nothing I do seems to fix those errors. Audit fix won't do it audit fix -force comes up empty as well. I try adding the proper versions to the json files but that does no good either. Even though I know it won't work, I try to build it anyway. Guess what???!?!?!! MORE ERRORS!!!! Keep in mind this file is currently working and was working just fine in the Studio but in the CLI...not so much. When I build it shows as "settings is imported by app/index.js, but could not be resolved" Strange as I changed NOTHING!. Let me restate that so it sinks in...I CHANGED NOTHING about this file but going to the CLI I get errors. I have spent hours on end installing node properly (your instructions leave ALOT to be desired) and trying to change an existing file. It has been months and I can't get it to open. I basically give up but then someone nice says they like the watch faces but would like to see a few changes and I try again....This is an absolute disaster of decision to move to the CLI without it actually working properly!

Best Answer
0 Votes

Hi @ChunkySoup703 - you are correct, an awful decision with insufficient documentation. Have spent weeks on this in the Windows environment, even on a brand new 64bit pc the install didn't even work. Total nightmare to get working as there are so many things that can go wrong.

Author | ch, passion for improvement.

Best Answer
0 Votes