Closed Digitalone1 closed 1 year ago
Interesting, as long as you've install all the dependencies you should be good. Since with npm you need to run npm install .
in the root of the project directory.
Otherwise it seems that some systems have trouble finding the module installed via npm so you could try npm test -- --updateSnapshot
since that apparently should have npm
add the ./node_modules/.bin
to your path.
Hopefully that helps
I was missing npm install .
Did it and:
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'atom-backend@1.0.0',
npm WARN EBADENGINE required: { node: '>= 14.0.0 < 16.16.0' },
npm WARN EBADENGINE current: { node: 'v16.18.0', npm: '8.19.2' }
npm WARN EBADENGINE }
added 720 packages, and audited 721 packages in 33s
95 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
npm notice
npm notice New major version of npm available! 8.19.2 -> 9.1.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.1.1
npm notice Run npm install -g npm@9.1.1 to update!
npm notice
Then npm rum test
failed:
> atom-backend@1.0.0 test
> set NODE_ENV=test&& set PULSAR_STATUS=dev&& jest
Error: Jest: Got error running globalSetup - ~/pkgbuild/atom/git/atom-community-server-backend-JS/node_modules/@databases/pg-test/lib/jest/globalSetup.js, reason: docker images --format "{{json .}}" exited with code 1:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json": dial unix /var/run/docker.sock: connect: permission denied
at ResultClass.getResult (~/pkgbuild/atom/git/atom-community-server-backend-JS/node_modules/modern-spawn/lib/index.js:47:25)
at ~/pkgbuild/atom/git/atom-community-server-backend-JS/node_modules/modern-spawn/lib/index.js:64:32
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async imageExists (~/pkgbuild/atom/git/atom-community-server-backend-JS/node_modules/@databases/with-container/lib/index.js:9:20)
at async pullDockerImage (~/pkgbuild/atom/git/atom-community-server-backend-JS/node_modules/@databases/with-container/lib/index.js:32:10)
at async Promise.all (index 0)
at async startContainer (~/pkgbuild/atom/git/atom-community-server-backend-JS/node_modules/@databases/with-container/lib/index.js:129:5)
at async getDatabase (~/pkgbuild/atom/git/atom-community-server-backend-JS/node_modules/@databases/pg-test/lib/index.js:42:42)
at async setup (~/pkgbuild/atom/git/atom-community-server-backend-JS/node_modules/@databases/pg-test/lib/jest/globalSetup.js:20:35)
at async ~/pkgbuild/atom/git/atom-community-server-backend-JS/node_mo
I started the docker systemd service before launching the test.
Any hint?
@Digitalone1 I'm going to assume that Docker was installing with sudo
, since I know on my Ubuntu server I have to use sudo
to start any container. Meanwhile I'm assuming you didn't use npm
as root or a sudoer. Now tbh I'm not sure if those root permissions will be able to be used by any dependency of npm
but I'd assume that you could at least try to use sudo npm run test
Or from ArchWiki I'm seeing you could use --unsafe-perms
.
Sorry I use this all on a Windows Environment with WSL enabled, so not to familiar with this build process on linux. But otherwise looking better than before
I got a slightly different error trying with sudo
WARNING: Error loading config file: /root/.docker/config.json: open /root/.docker/config.json: permission denied
It seems like I should run a docker instance on my user, but I don't know how. The only way to start docker is through systemd service, but it's using its own custom user which I don't have rights. There's no user service provided by docker package.
Don't know how to resolve, it's the first time I use these utilities.
Read my comment below for what I feel is the most likely solution here
@Digitalone1 that is interesting. I've found a post on Stackoverflow that might be helpful. But otherwise this weekend I might have to replicate your setup and see what's going on, or if I can recreate it.
Now with that link keep in mind the above that they added their user to the right group. But let me see what I can find out, if you wouldn't mind dropping the version of Arch you have installed?
But otherwise in the meantime, feel free to let the actions speak for the tests. I'm trying to look on the Repo that creates the docker container for these tests to see if anyone has run across similar issues. But not having to much luck.
At least in the meantime there's still a bit of cleanup todo. There were a few refactor things I had wanted to do before we hit 1.0, if you'd like I'll make some issues for them
@Digitalone1 Or, this may be a fix. Looks like npm
scripts are always run with the permissions of the working directory owner. Docs, so maybe if you were to sudo chown root:root ./ -R
from the project directory, then confirm it's owner by root ls -l ./
when you then use sudo npm test
it will run the scripts inside package.json
as the root user, which should then allow it to start up the Docker Containers and manage the Docker Daemon.
Just an idea and I'm unable to test this, but hoping that would be the solution
Unfortunately I don't have a .docker
folder in the home
directory of my user.
I don't feel like changing the owner of the entire project folder to root is a good solution. It's not safe, the user folder is made to not run as root.
Anyway, installing Arch only to do tests on docker seems overkill. Are you sure? ^^
It's tricky to install. However if you want, just pick from here. Follow installation guide.
Unfortunately I don't have a
.docker
folder in thehome
directory of my user.I don't feel like changing the owner of the entire project folder to root is a good solution. It's not safe, the user folder is made to not run as root.
Anyway, installing Arch only to do tests on docker seems overkill. Are you sure? ^^
It's tricky to install. However if you want, just pick from here. Follow installation guide.
That's fair it's not the most secure. Just seems like the most likely solution I'm seeing. But realistically I'd probably try Manjaro first, since it's at least based on Arch. But we will see how much time I find this weekend.
Please let me know if in the meantime you find a different solution
Choose which distro you want, anyway I recommend https://endeavouros.com/ over Manjaro.
I read EOS uses the same repo of Arch while Manjaro has it's own customized repo which is slightly behind vanilla Arch.
To install docker and npm:
pacman -Syu docker npm
Or yay
in place of pacman which is an helper and lookup also on packages over AUR.
I know you need to add your user to docker group and reboot Linux for docker to work - did you do that?
I just tried that and it worked.
` $ docker --version # needs to be <19.3
$ # check to see if you have a docker group already $ getent group | grep docker
$ # if not .. $ sudo gpasswd -a $USER docker
$ # if you want to put off logging out and back in again this will start $ # a new shell that knows you are in the docker group $ newgrp docker ` I just cloned, installed and ran tests. I got lots of errors but at least the tests ran --BobG
Thank you @mauricioszabo @bobjunga
Adding my user to docker group solved the issue.
@confused-Techie you don't need to install Arch or one of its derivatives. :)
I'm happy to hear this issue was resolved! Thanks to everyone that helped out!
I know this could be asked on DIscord, but here I can track it better.
I tried to run tests on my system, but failed. Installed docker and npm on Arch Linux.
But on
npm run test
I gotWhat am I missing?