Unable to install Forge CLI on gmpowerhorse (Ubuntu 20.04.2 LTS 64-bit)
Closed this issue · 10 comments
I got stuck trying to install Atlassian Forge CLI which should be a prerequisite for testing #25
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$ npm i -g @forge/cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/gmacario/.npm/_logs/2021-09-11T08_01_21_710Z-debug.log
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$
I also tried prepending sudo
but still got errors
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$ sudo npm i -g @forge/cli
/usr/local/bin/forge -> /usr/local/lib/node_modules/@forge/cli/out/bin/cli.js
> keytar@5.6.0 install /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
> prebuild-install || node-gyp rebuild
prebuild-install WARN install EACCES: permission denied, access '/root/.npm'
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/14.17.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@forge/cli/node_modules/keytar/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@forge/cli/node_modules/keytar/.node-gyp'
gyp ERR! System Linux 5.4.0-80-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
gyp ERR! node -v v14.17.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
> @forge/cli@2.0.1 postinstall /usr/local/lib/node_modules/@forge/cli
> node -e "process.exitCode = fs.existsSync('./out/bin/postinstall.js')" || node ./out/bin/postinstall.js
/usr/local/lib/node_modules/@forge/cli/node_modules/conf/index.js:453
throw error;
^
Error: EACCES: permission denied, open '/root/.config/@forge/cli-nodejs/config.json'
at Object.openSync (fs.js:498:3)
at Object.readFileSync (fs.js:394:35)
at Conf.get store [as store] (/usr/local/lib/node_modules/@forge/cli/node_modules/conf/index.js:423:18)
at new Conf (/usr/local/lib/node_modules/@forge/cli/node_modules/conf/index.js:119:26)
at new CachedConf (/usr/local/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/cache/cached-conf.js:8:21)
at Object.<anonymous> (/usr/local/lib/node_modules/@forge/cli/out/bin/postinstall.js:13:20)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/root/.config/@forge/cli-nodejs/config.json'
}
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: keytar@5.6.0 (node_modules/@forge/cli/node_modules/keytar):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: keytar@5.6.0 install: `prebuild-install || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @forge/cli@2.0.1 postinstall: `node -e "process.exitCode = fs.existsSync('./out/bin/postinstall.js')" || node ./out/bin/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @forge/cli@2.0.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-09-11T08_03_05_445Z-debug.log
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*
@Raffone17 and @gteti any suggestions?
I believe you managed to install Forge CLI on your machine, right?
I've had the same errors ( check #3)
I think it is related on ubuntu's node.js. I tried to install the standard node, which should be version 12.something, and fixed my issue.
Ah OK, so it looks like Forge CLI has not yet been ported to Node 14.x LTS?
I'm not certain yet, try with the standard installation of node (on ubuntu it should be, as I mentioned the 12.XX) then:
Login to forge following the forge login
explained here: https://developer.atlassian.com/platform/forge/getting-started/
Once logged into the CLI, you can:
- Clone this repository
- Run
forge register
to register the new app to your developer account - Install dependencies with
npm install
to install your dependencies forge deploy
to deploy the app into the default environment of your websiteforge install
and follow the prompted texts to install the app
I've just installed it for testing on https://teti.atlassian.net/wiki/home
Try switching to Node.js 12.x using the n
tool which @Raffone17 and myself have used a lot during DBWA development
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$ sudo n 12.22.6
installing : node-v12.22.6
mkdir : /usr/local/n/versions/node/12.22.6
fetch : https://nodejs.org/dist/v12.22.6/node-v12.22.6-linux-x64.tar.xz
installed : v12.22.6 (with npm 6.14.15)
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$ node --version
v12.22.6
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$
However even with latest Node.js 12.x Forge CLI refuses to install:
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$ npm i -g @forge/cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/gmacario/.npm/_logs/2021-09-11T17_05_04_021Z-debug.log
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$ ls -la /usr/local/lib/node_modules/
total 12
drwxr-xr-x 3 root root 4096 Sep 11 19:03 .
drwxr-xr-x 6 root root 4096 Jul 7 19:14 ..
drwxr-xr-x 10 root root 4096 Sep 11 19:01 npm
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$
It looks like directory /usr/local/lib/node_modules
is owned by user root
.
Let us try prepending sudo
:
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$ sudo npm i -g @forge/cli
/usr/local/bin/forge -> /usr/local/lib/node_modules/@forge/cli/out/bin/cli.js
> keytar@5.6.0 install /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
> prebuild-install || node-gyp rebuild
prebuild-install WARN install EACCES: permission denied, access '/root/.npm'
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/12.22.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@forge/cli/node_modules/keytar/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@forge/cli/node_modules/keytar/.node-gyp'
gyp ERR! System Linux 5.4.0-80-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
gyp ERR! node -v v12.22.6
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
> @forge/cli@2.0.1 postinstall /usr/local/lib/node_modules/@forge/cli
> node -e "process.exitCode = fs.existsSync('./out/bin/postinstall.js')" || node ./out/bin/postinstall.js
/usr/local/lib/node_modules/@forge/cli/node_modules/conf/index.js:453
throw error;
^
Error: EACCES: permission denied, open '/root/.config/@forge/cli-nodejs/config.json'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at Conf.get store [as store] (/usr/local/lib/node_modules/@forge/cli/node_modules/conf/index.js:423:18)
at new Conf (/usr/local/lib/node_modules/@forge/cli/node_modules/conf/index.js:119:26)
at new CachedConf (/usr/local/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/cache/cached-conf.js:8:21)
at Object.<anonymous> (/usr/local/lib/node_modules/@forge/cli/out/bin/postinstall.js:13:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/root/.config/@forge/cli-nodejs/config.json'
}
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: keytar@5.6.0 (node_modules/@forge/cli/node_modules/keytar):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: keytar@5.6.0 install: `prebuild-install || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @forge/cli@2.0.1 postinstall: `node -e "process.exitCode = fs.existsSync('./out/bin/postinstall.js')" || node ./out/bin/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @forge/cli@2.0.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-09-11T17_08_18_657Z-debug.log
gmacario@gmpowerhorse:~/github/aquariophilie/axolotl (main)*$
I am afraid I need to look inside Forge CLI source code
I'm now stuck in "allowing" the app to access the space teti.atlassian.net
I'm now stuck in "allowing" the app to access the space teti.atlassian.net
AFAIK your problem is unrelated to Forge CLI, would you mind open a separate issue and discuss it there?
@Raffone17 and myself experienced the same yesterday but I am not sure we sorted that out yet
I tried to install Forge CLI after cleaning up my installation of Node
sudo -i
mv /usr/local/lib/node_modules /usr/local/lib/node_modules.OLD
mv ~/.cache ~/.cache.OLD
mv ~/.npm ~/.npm.OLD
n list lts
n install 14.17.3
node --version
npm --version
exit
Result:
root@gmpowerhorse:~# n list lts
node/12.22.3
node/12.22.6
node/14.17.3
root@gmpowerhorse:~# n install 14.17.3
installed : v14.17.3 (with npm 6.14.13)
root@gmpowerhorse:~# node --version
v14.17.3
root@gmpowerhorse:~# npm --version
6.14.13
root@gmpowerhorse:~# exit
gmacario@gmpowerhorse:~ $
Now logged again as gmacario, try installing Forge CLI globally
sudo chown -R $USER /usr/local/lib/node_modules
npm config set unsafe-perm true
npm i -g @forge/cli
Result:
gmacario@gmpowerhorse:~ $ npm i -g @forge/cli
/usr/local/bin/forge -> /usr/local/lib/node_modules/@forge/cli/out/bin/cli.js
> keytar@5.6.0 install /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
> prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=14.17.3 runtime=node arch=x64 libc= platform=linux)
Package libsecret-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsecret-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsecret-1' found
gyp: Call to 'pkg-config --libs-only-l libsecret-1' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:375:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.4.0-84-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
gyp ERR! node -v v14.17.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
> @forge/cli@2.0.1 postinstall /usr/local/lib/node_modules/@forge/cli
> node -e "process.exitCode = fs.existsSync('./out/bin/postinstall.js')" || node ./out/bin/postinstall.js
ℹ To install autocompletion for Forge, run 'forge autocomplete install'.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: keytar@5.6.0 (node_modules/@forge/cli/node_modules/keytar):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: keytar@5.6.0 install: `prebuild-install || node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ @forge/cli@2.0.1
added 775 packages from 436 contributors in 19.728s
gmacario@gmpowerhorse:~ $
Try again after installing the missing library (`libsecret-1-dev`)
```bash
sudo apt install -y libsecret-1-dev
sudo npm config set unsafe-perm true
sudo npm i -g @forge/cli
Result:
gmacario@gmpowerhorse:~ $ sudo npm config set unsafe-perm true
gmacario@gmpowerhorse:~ $ sudo npm i -g @forge/cli
/usr/local/bin/forge -> /usr/local/lib/node_modules/@forge/cli/out/bin/cli.js
> keytar@5.6.0 install /usr/local/lib/node_modules/@forge/cli/node_modules/keytar
> prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=14.17.3 runtime=node arch=x64 libc= platform=linux)
make: Entering directory '/usr/local/lib/node_modules/@forge/cli/node_modules/keytar/build'
CXX(target) Release/obj.target/keytar/src/async.o
In file included from ../src/async.cc:4:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2294:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
2294 | , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
| ^
CXX(target) Release/obj.target/keytar/src/main.o
In file included from ../src/main.cc:1:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2294:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
2294 | , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
| ^
CXX(target) Release/obj.target/keytar/src/keytar_posix.o
SOLINK_MODULE(target) Release/obj.target/keytar.node
COPY Release/keytar.node
make: Leaving directory '/usr/local/lib/node_modules/@forge/cli/node_modules/keytar/build'
> @forge/cli@2.0.1 postinstall /usr/local/lib/node_modules/@forge/cli
> node -e "process.exitCode = fs.existsSync('./out/bin/postinstall.js')" || node ./out/bin/postinstall.js
ℹ To install autocompletion for Forge, run 'forge autocomplete install'.
+ @forge/cli@2.0.1
added 810 packages from 455 contributors in 23.048s
gmacario@gmpowerhorse:~ $
Hooray! I eventually managed to install Forge CLI - maybe this is not the most secure way for installing it, but that's OK for the moment:
gmacario@gmpowerhorse:~ $ forge --version
2.0.1
gmacario@gmpowerhorse:~ $