06-04-2022 11:41
06-04-2022 11:41
running "npx create-fitbit-app swipe" gives the following output:
Need to install the following packages:
create-fitbit-app
Ok to proceed? (y) y
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
Creating a new Fitbit SDK app in /Users/*****/Documents/coding/fitbit/swipe.
Installing packages. This might take a couple of minutes.
Installing @Fitbit/sdk and @Fitbit/sdk-cli...
npm ERR! code 1
npm ERR! path /Users/*****/Documents/coding/fitbit/swipe/node_modules/keytar
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/keytar/src/async.o
npm ERR! In file included from ../src/async.cc:1:
npm ERR! In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:506:
npm ERR! In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string_view:175:
npm ERR! In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:57:
npm ERR! In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:641:
npm ERR! In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstring:60:
npm ERR! /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string.h:60:15: fatal error: 'string.h' file not found
npm ERR! #include_next <string.h>
npm ERR! ^~~~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/keytar/src/async.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/Users/*****/.nvm/versions/node/v18.3.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/Users/*****/.nvm/versions/node/v18.3.0/bin/node" "/Users/scwaller/.nvm/versions/node/v18.3.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/*****/Documents/coding/fitbit/swipe/node_modules/keytar
npm ERR! gyp ERR! node -v v18.3.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/*****/.npm/_logs/2022-06-04T17_18_37_890Z-debug-0.log
Aborting installation.
npm install --save-dev --save-exact --loglevel error @Fitbit/sdk-cli @Fitbit/sdk has failed.
Deleting generated file... package.json
Deleting swipe/ from /Users/*****/Documents/coding/fitbit
Done.
It seems the important line is "/string.h:60:15: fatal error: 'string.h' file not found", which from some google searches might stem from using c++ instead of clang. The error happens in the command "sh -c prebuild-install || node-gyp rebuild" in swipe/keytar, but the script deletes the entire project file once it runs into this error which makes it impossible to troubleshoot this file. I am new to using node and npm, so I don't know what steps to take. Is there a way to stop the auto-delete part of the script? Or is there a better approach here?
06-04-2022 12:19
06-04-2022 12:19
To be clear, this is definitely an issue with my machine and I don't expect people here to be able fix it, however I would like help with how to troubleshoot/stop/pick apart the automated setup scripts so I can figure out how to fix it. Thanks!
06-04-2022 13:24
06-04-2022 13:24
I think clang is a compiler (or interface to a compiler), rather than a language. clang can compile C++.
What version of node are you running? If it's 18 or later, you could try dropping back to 16 or even 14.