Gnome extension to update system - javascript

I am trying to add a button into my Extension that, when clicked runs sudo apt update and sudo apt upgrade but it keeps crashing/not doing anything.
I have tried:
Util.spawnCommandLine('gnome-terminal -- sudo apt update && sudo apt upgrade');
and
Util.spawnCommandLine('gnome-terminal -- sudo apt update | sudo apt upgrade');

Related

Chrome refuses to run inside of docker container on M1 when doing nightwatch tests

I have tried running a docker image, that previously worked on a non-M1 platform, to run nightwatch tests using Chromedriver and chromium. When I switched to an M1 mac, the first assertion of the test would fail, which implied that Chrome wasn't even starting up in the first place. I tried Chromium and google-chrome-stable, both of which had the same failure. I also tried running a VNC server inside of the docker container to see what is going on. When I got in and tried to start chrome, nothing happened. When I tried to start Chromium I got a message that it is not supported on the current hardware.
This is how I build my docker container :
FROM node:10-buster-slim
WORKDIR /home/node
# Installing some missing but critical items:
# Chromium info: https://www.chromium.org/
RUN \
apt-get update && \
useradd apps && \
mkdir -p /home/apps && \
chown apps:apps /home/apps && \
apt-get install -y \
libglib2.0-0 \
libnss3 \
libx11-6 \
wget \
x11vnc \
xvfb \
fluxbox \
wmctrl \
gnupg2 && \
apt-get clean && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \
apt-get update && apt-get -y install google-chrome-stable
COPY docker-startup.sh /
RUN chmod 777 /docker-startup.sh
CMD '/docker-startup.sh'
# Copy only package.json and package-lock to start.
# Allows packages to to be cached in Docker layers, preventing the need to
# repeatedly re-install packages for any update to ui-tests.
COPY package.json package-lock.json ./
# Install testing dependencies (Nightwatch, Chromedriver)
# Use npm ci to install using package-lock.json, and not replace its contents.
# FYI: npm i chromedriver uses the version # from package.json
RUN \
npm ci && \
npm i -g nightwatch#0.9.21 && \
npm i -g chromedriver#latest --unsafe-perm=true --allow-root
# Copies code over to the default working directory:
# The below COPY assumes you are copying /ui-tests to /ui-tests
COPY . .
# Sets variable used in Nightwatch Reporter:
ENV TEST_ENV=docker
ENV TERM=xterm-256color
# Resolves socket error / ECON reset
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
There is a .sh script called docker-startup.sh that just sets up and runs the VNC server for me to be able to see what is going on, that is not too important in this case.
The command used to run the docker container is this
docker run --privileged -p 5900:5900 --user apps -e VNC_SERVER_PASSWORD=password --platform linux/amd64 -e APPBRANCH=$(git rev-parse --abbrev-ref HEAD) -v ~/work/dev/services/beast-portal/ui-tests/screenshots:/home/node/screenshots -v ~/work/dev/services/beast-portal/ui-tests/reports:/home/node/reports --env-file ./nightwatch.env nightwatch:stable nightwatch --env {--EnvironmentToTestIn--} --test {--TestToRun--.js}
This runs the docker container and then runs the nightwatch test with a given environment and a given test file.
The command used to build the docker file is this :
cd ~/work/dev/services/beast-portal/ui-tests && docker build --platform linux/amd64 -t \"nightwatch:stable\" .
I have also tried messing with the versions of Chromedriver and nightwatch but that still gave the same error where it fails to verify the first assertion as chrome isn't even started from the looks of it. This feels like an M1 architecture issue but I can't figure it out.

Can't install NPM

Image of my terminal in VSCode
I've tried uninstalling/reinstalling node and clearing the cache but I can't seem to figure it out. Any ideas?
I'm on Windows 10 if that helps
Try these:
Delete node_modules folder if you have one.
Delete package.lock.json.
Then...
sudo apt update
sudo apt upgrade
sudo apt install nodejs
npm install
It seems that it's conflicting with chokidar.
First of all you need to delete node_modules and package-lock.json not package.json
and then add cmd
npm install --force
if you are using Ubuntu OS use
sudo npm install
I had a similar issue before and I believe it has to do with your nodejs. I suggest you reinstall your node cause it might solve the issue.
Try purging it
sudo apt-get purge nodejs
Then remove dependencies
sudo apt-get autoremove
Then reinstall
sudo apt install nodejs
Also try updating your chokidar and axios to a newer version, yours is already depreciated.

VueJS: Building for production...Killed

When running npm run build or vue-cli-service build. I get the message "Building for production...Killed" after about 30 seconds. The build works for me locally (MacOS), but when I try to deploy it on a DigitalOcean Server (CentOS 8.2 x64) it fails to build. Any ideas?
I found my the solution to my problem by increase the swap memory on my server. I solved it using these steps...
Run sudo fallocate -l 4G /swapfile; ls -lh /swapfile; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile; sudo swapon -s; free -m;
Then run sudo vim /etc/fstab then add this to the bottom of the file -> /swapfile none swap sw 0 0

Install Node 6.9 on Ubuntu Zesty 17.04

I want to install a newest version of NodeJS on Ubuntu Zesty 17.04. But whether using apt-get or trying to download it from nodesource ppa, I always have the version 4.7.2.
Apt-get
sudo apt-get update
sudo apt-get install nodejs npm
Node PPA
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get update
apt-get install nodejs npm
Result
$> node -v
v4.7.2
How can I get the version 6.9 of NodeJS ?
I didn't succeed to install it via apt-get or nodesource ppa. However I solved the problem by installing Node manually by following these steps :
Remove the old version sudo apt-get remove --purge node
Download Node binaries from https://nodejs.org/en/
Extract the archive where you want tar -xzf <ARCHIVE>.tar.gz -C <YOUR_FOLDER>
Create a node symbolic link ln -sf <YOUR_FOLDER>/bin/node /usr/bin/node
Create a nodejs symbolic link ln -sf <YOUR_FOLDER>/bin/node /usr/bin/nodejs
result :
radouane#roufid:$ node -v
v6.10.2
I hope it helps !
Best way is to use n. It is a node module that helps you to update and switch between node versions easily.
npm install n --global
n list will list all node versions.
If you want to switch to new version 6.10.2 use command
n 6.10.2
To install the NodeJS any version
# you can replace number 6 with new version
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt install nodejs
node -v

Install yarn in a docker container says missing dependency

I'm using the node:6.7.0 image as my docker container and then follow the installation guide for yarn
sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Then I do
apt-get update && apt-get install yarn
But at this point I get an error message which says
yarn : Depends: nodejs (>= 4.0.0) but it is not going to be installed
I've echoed node -v before the install and it also says 6.7.0
Anything that I'm missing?
robertklep is right - if you check the Dockerfile for Node you'll see they install Node by downloading the TAR, not through APT. You can check this by running an interactive container:
> docker run -it node:6.7.0 bash
root#465fa07437c9:/# dpkg -s nodejs
dpkg-query: package 'nodejs' is not installed and no information is available
You can use NPM in your Dockerfile instead:
FROM node:6.7.0
RUN npm install -g yarn

Categories