Forge CLI version 5.0.0 - 31 August 2022

We have released version 5.0.0 of the Forge CLI.

:lock: Forge CLI implements stricter credential storage and access

The CLI now requires the use of a local keychain to store and access credentials (alternatively, you can set credentials via environmental variables). Upon updating the CLI, it removes any existing plaintext credentials from previous CLI versions.

For more information about storing and accessing Forge credentials, refer to the Getting started guide.

Run npm install -g @forge/cli@latest on the command line to install the latest version of @forge/cli.

2 Likes
C:\KC>npm install -g @forge/cli@latest
npm ERR! code 1
npm ERR! path C:\Users\IGS\AppData\Roaming\npm\node_modules\@forge\cli\node_modules\keytar
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.15.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.6 found at "C:\Users\IGS\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.0/node-v16.15.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.15.0/node-v16.15.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.0/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.0/win-arm64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.0/win-x86/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.0/win-x64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.15.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.15.0/win-x86/node.lib
npm ERR! gyp http 404 https://nodejs.org/download/release/v16.15.0/win-arm64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.15.0/win-x64/node.lib
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 could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\li....

Forge now requires Python (wasn’t needed in Forge 4.5.0) and Visual Studio too?

Edit:
After installing Python and Visual Studio, Forge 5.0.0 install is successful.
You may want to update the getting started page (Installing Forge on Windows 10) to reflect this.

1 Like

Hi KC Wong,

This isn’t expected. Forge CLI 5.0.0 does install additional dependencies to ensure your credentials are stored securely, but we haven’t seen this problem.

I’m now investigating what might have caused your issue.

From my understanding, the official Node.js installer includes all the tools Forge and its dependencies needs. Do you mind telling us how did you install Node on this machine? And which Windows edition, version and build are you using?

Also please note that Visual Studio shouldn’t be required, only the build tools - see GitHub - nodejs/node-gyp: Node.js native addon build tool.

I used node-v16.15.0-x64.msi downloaded from Download | Node.js.

When I first executed “npm install -g @forge/cli@latest”, it complains about being unable to locate a usable Python. So I installed the latest version of Python and have it added to PATH. Then I got the message about not finding Visual Studio in my previous post.

I found this:

Looks like node-gyp requires a C++ compiler, and its error message is written to ask for Visual Studio instead of Windows SDK.

:mega: If you’re affected by this issue, Node.js installer has an option to install “Tools for Native Modules” which will download everything required.

However, Forge should install without the need for those and we’ll keep investigating.

1 Like

Hi,

This getting started guide is not that clear to me…
https://developer.atlassian.com/platform/forge/getting-started/?_ga=2.39388134.410996293.1661858301-967415997.1661858301#using-environment-variables-to-login

Currently, I’m using secrets when using Forge login. The secrets are stored in my GitHub repository.
How should I use it now? Can you please provide an example for Linux machine?

I have since today the same issue. For the moment I moved back to version 4.5.2. This is working as yesterday fine :slight_smile:

Looking forward for a fix

2 Likes

This has broken our bitbucket build pipeline as well which is running node v16.13.2 and npm v8.1.2 on linux. Similar looking keytar/nodegyp/python errors.

npm install -g @forge/cli
24s
+ npm install -g @forge/cli
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.3.0
npm ERR! gyp info using node@16.13.2 | linux | x64
npm ERR! gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.2/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/@forge/cli/node_modules/keytar/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/root/.cache/node-gyp/16.13.2/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/16.13.2',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.13.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/usr/local/lib/node_modules/@forge/cli/node_modules/keytar',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Package libsecret-1 was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `libsecret-1.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'libsecret-1' found
npm ERR! gyp: Call to 'pkg-config --cflags libsecret-1' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 5.15.0-1017-aws
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v8.3.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-08-31T13_34_41_480Z-debug.log

We don’t install node directly in our pipeline. We simply specify it as our pipeline image:
image: node:16.13.2
If you have a recommended docker image that includes these tools we’d love to hear it.

I updated our docker image to
node:17.9.1
but it still fails. As @ChristianWestendorf suggested I moved back to @forge/cli@4.5.2 and at least its working.

I had to install the libsecret-1-dev and libsecret-1-0 in my container so I could install the latest @forge/cli

sudo apt-get update
sudo apt install libsecret-1-dev libsecret-1-0

But when I tried to log in with forge cli, it still complains libsecret not being installed

UPDATE: I think the root error is “Cannot autolaunch D-Bus without X11 $DISPLAY”

Same problem here with Ubuntu 20.04 and node 16.16

1 Like

I haven’t cross-checked this with Forge CLI 5.0.0 yet, just quickly as additional input for those investigating - the various errors discussed here sound remarkably similar to what has been discussed for the Forge CLI 1.6.0 update in April 2021, here’s our summary:

The TL;DR is that we had to deviate from the instructions and use install @forge/cli@2.0.1 --omit optional to avoid the errors stemming from the back then optional keytar dependency, though IIRC that problem had been partially mitigated by the Forge team in a later CLI version.

Of course, the scope of the major release at hand seems to be to now require a local keychain, which means the never fully addressed problem around that dependency could now be a significant hurdle or even blocker depending on the target environment.

Dear Forge users,

Our team has been investigating this issue and we have found that it could be related to an issue with npm 8 which creates trouble installing keytar.
We are actively working on a fix and will keep you posted this week.

Best regards,
Nicolas - Forge Dev team

it could be related to an issue with npm 8 which creates trouble installing keytar.

Indeed, I’m using npm 8.5.5.

If you don’t want to change npm version, you can reinstall an old cli version with:

npm install @forge/cli@4.5.2

and wait for a fix to cli 5.0.0.

2 Likes

Can we get a confirmation that a fix will be coming? And that we won’t be required to upgrade to 5.x until it’s there?

We’re working on a fix as a priority. There are no plans to bump the minimum required version, and we won’t bump it while the latest version is broken like this.

Again, sorry for the inconvenience.

1 Like

@WeiwenChi, this is because your container does not have access to your system keychain. Are you using the container for local development or is it your CI system?

You might want to use environment variables (set them when you launch the container): https://developer.atlassian.com/platform/forge/getting-started/#using-environment-variables-to-login

Thanks @AlexeyKotlyarov. I am using the container for both local development and CI system. Is there any instruction for how to set up system keychain in the container. For now, I am using environment variables as a workaround.

Dear Forge users,

Thank you all for your comments and for reporting this issue.

An incident has been created and we have updated the status page.
Please refer to this link for further updates: Atlassian Developer Status - Forge CLI version 5.0.0 installation or upgrade is failing when running on npm 8

Thank you all for your patience.
Best regards,
Nicolas

1 Like