nodejs run cd and zip command always failed - node.js

all. I ran into a strange situation.
os: macOS
I can run zip -r test.zip * in the console. Then I try to do this in a script with nodejs and a plugin called 'webpackshellplugin-next'. I import this plugin and then call it to run script when the build process exits. I try to zip some files in the ./build/ folder, just something like the screenshot.
I failed in the 2nd step, to cd ./build && ..., because I see the console shows no such file or directory when it tries to cp ./build/xxx.mpk to other directory. I check the ./build directory, the xxx.mpk file is not generated.
Can I examine why this script failed?

Related

Teressa - Unable to Install from binary distribution

Im having difficulty installing teressa from a binary distribution. (https://docs.tessera.consensys.net/en/stable/HowTo/Get-started/Install/Distribution/) I have extracted the .tar file from the github link however the teressa/bin command only displays 1 command which is the teressa help command despite me running various different commands such as terresa version and terresa -keygen , it will still only display the teressa help command and I am unsure why that is the case
My Script:
C://Program Files/ tar xvf tessera-dist-22.1.7.tar
(To extract tar file from github repo under docs)
C://Program Files/ cd tessera-22.1.7/bin/ tessara help
(Shows help)
C://Program Files/ cd tessera-22.1.7/bin/ tessara version
(Shows help again)
Update: I managed to get the Tessera functions to work properly through running the tessera image on docker desktop.
I used docker run quorumengineering/tessera:latest on command prompt/windows powershell. And docker cp container-id:/path C://Program Files to copy and paste my private keys from docker container into my local windows file explorer

Linux Newb ./config: No Such file or directory

I'm new to Linux and I'm trying to install a program called OpenSSL. I'm following a guide and it says to download the tar file, so i created a directory called Website_Related with the path
~/Downloads/Website_Related
and downloaded the tar file from that directory with the command
wget http://www.openssl.org/source/openssl-1.0.2o.tar.gz
This went fine. Then the guide says to execute the following command
$ ./config \
--prefix=/opt/openssl \
--openssldir=/opt/openssl \
enable-ec_nistp_64_gcc_128
I tried executing this command from the same directory where I downloaded the file to and I get an error "No such file or directory". I also tried executing the command from my home directory and got the same error. The guide gives an explanation for the "enable-ec_nist_64_gcc_128" but not the rest of the command.
What is going on here? I did some research and saw . is often a directory having to do with configuration in your home directory, and I can see it in my home directory with
ls -a
command, but if i try to go into it with
cd .
that fails. Could someone please explain to me what this ./config command is attempting to do, and why it is failing?
Thank you.
You need to unpack it first:
tar vxf openssl-1.0.2o.tar.gz

Elasticsearch installation error: No such file or directory

I'm using a linux machine. The Elasticsearch installation guide told me to simply download and unzip the file, and then run bin/elasticsearch. But when I ran it, I got this error:
$ bin/elasticsearch
-bash: bin/elasticsearch: No such file or directory
I can clearly see the elasticsearch file in my home directory, and all the files within it seem intact. What do I do?
If you are trying to access the file with:
bin/elasticsearch
You get the error.
Try to tell the full route.
First move to the directory with cd
cd route/to/your/directory
Then use . for calling from your actual position:
./bin/elasticsearch
Note: If you get an error about the access or something similar, try giving execution permission to your file:
chmod u+x ./bin/elasticsearch

How to set up shell alias so I can change directories

I use bower and grunt in my workflow, and I wanted to install bower at the same time as grunt and pull down all my bower dependencies. So I created a package.json file that has a script attached on postinstall, which I also pass my github project repo, and dropped my post_install.sh into /root/bin.
{ // snippet of package.json
...
"scripts": {
"postinstall": "bin\\post_install.sh https://github.com/blah/blah.git
},
...
}
so running npm install would run post_install.sh, which runs
#!/bin/bash
node_modules/.bin/bower install
grunt setup
git init
git add .
git commit -m "Initial commit of project artifacts"
git remote add origin $1
git push -u origin master
This only works if I set git bash to open in my project directory. So I've been trying to figure out how to switch directories from where git bash opens at /htdocs to /htdocs/myproject using an alias. I read up on how to set this I thought, but I can't figure out how to invoke this file... incidentally also tried putting it in another .sh file to see if that worked.
#!.bashrc
alias projDir='cd /onloadsolutions'
What am I doing wrong that the alias above in /bin/.bashrc won't execute in my post_install.sh when dropped above "grunt setup"?
Dropping this into post_install.sh
echo "script running has basename `basename $0`, dirname `dirname $0`"
echo "present working directory is `pwd`"
gives a basename of D:/htdocs/onloadsolutions/bin/post_install.sh, but my present working directory is /d/htdocs, which when the bower and git commands run they do it in the wrong directory.
Not 100% sure what you mean but I am guessing when you open bash you want to
be able to type a command to take you to your project
then type npm install and have it pull down all your dependencies
Try editing your .bashrc file (this should be in your home directory, not in the /bin folder) to access this you can use something like
nano ~/.bashrc
(~/ is a shortcut to your home directory)
and look in it for any existing alias commands or add yours down the bottom.
then after opening another bash session (.bashrc only runs when you first start terminal) you should be able to see your current aliases by typing "alias"
you can launch the alias you mentioned above by typeing "projDir" into the console. It would be much better to add the full path in your alias i.e.
alias projDir='cd /var/www/onloadsolutions'
then you can call it from anywhere. Otherwise you might end up in a different folder than you expect.
UPDATE
See comments below.
Put cd $2 in the second to top line of the post_install.sh file and add a second parameter to the package.json file that calls it.

How to install rabbitmq and erlang on centOS without root user?

Can anyone help me with installation?
I have install virtualEnv and trying to install both of these. but not sure it is correct or not.
I know this is an old version, but it worked for me on a different Linux build (Mate OS). Follow the steps in this blog post which I have simplified below.
Download the below
ERLANG from OTP R16B03-1 Source File
RabbitMQ from RabbitMQ Server.tar.gz
Installing Erlang
Extract the ERLANG file
cd to source folder
run $ configure
run $ make
Open Makefile and change /Users/deepkrish/Application/erlang to a suitable directory
The line you are looking for is the below:
# prefix from configure, default is /usr/local (must be an absolute path) prefix = /Users/deepkrish/Application/erlang
Run $ make install
Once Erlang is installed non root user add the erlang/bin to PATH in .bash_profile like below:
export ERLANG=”/Users/deepkrish/Application/erlang/bin”
export PATH=${ERLANG}:${PATH}
Now execute the profile by running `$ source .bash_profile” or log off and login again.
Check $ erl -version This should give you the below:
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4
Installing RabbitMQ
Untar the RabbitMQ.tar file and $ cd to the extracted folder
run $ make
2. This should create a scripts folder. Now change into that. $ cd scripts
Now change the below in the rabbitmq-defaults file. This will change where we run and log rabbitMQ. You can change it to the folder you want to run RabbitMQ from as below
### next line potentially updated in package install steps SYS_PREFIX=~/Application/RabbitMQ
Save and close the file
Now create a directory mkdir -p ../etc/rabbitmq Note that if you don't have access to the /etc directory you can also change it to somewhere else.
./rabbitmq-plugins enable rabbitmq_management
Start rabbitmq server $ ./rabbitmq-server &
I use the below script file to start RabbitMQ server whenever I log on.
#!/bin/sh
cd /home/myusername/myproject/RabbitMQ/rabbitmq-server-3.2.3/scripts
export ERLANG="/home/myusername/myproject/RabbitMQ/erlang/bin"
export PATH=${ERLANG}:${PATH}
./rabbitmq-server &

Resources