'yarn offline' use absolute path when setting 'yarn-offline-mirror' path - yarnpkg

I am trying to create yarn offline mirror. I followed the steps mentioned
here
When setting offline-mirror-dir as in the link above:
"$ yarn config set yarn-offline-mirror ./npm-packages-offline-cache"
where ./npm-packages-offline-cache is an example location relative to home folder where all the source .tar.gz files will be downloaded to from the registry.
I need to set an absolute path instead of relative path? How can I do that?
$ yarn --version
1.2.1

For an absolute path simply specify the full path. ( Which would start with root / instead of the dot . ) Example:
$ yarn config set yarn-offline-mirror /tmp/npm-packages-offline-cache
$ yarn install
$ ls /tmp/npm-packages-offline-cache
A path relative to where yarn is executed instead of home can be specified as follows:
$ yarn config set yarn-offline-mirror vendor/npm-packages-offline-cache
$ cd ~/my_project
$ yarn install
$ ls ~/my_project/vendor/npm-packages-offline-cache

Related

yocto project runqemu: command not found

I am setting up my yocto project, for that i have followed these below steps:
download the Poky Source code (ubuntu: /yocto/source)
$ git clone git://git.yoctoproject.org/poky
Checkout the latest branch/release (zeus)
$ git checkout zeus
Step 3: Prepare the build environment (ubuntu: /yocto/source/poky)
$ source oe-init-build-env ../../build
The above script will move in a build folder and create two files in conf folder ( local.conf, bblayers.conf ) inside conf folder
Building Linux Distribution (unbuntu: /yoctu/build)
$ bitbake core-image-minimal
Checking the runqemu (ubuntu: /yocto/source/poky/scripts)
$ ls runqemu // and it is there
Run generated image in qemu (ubuntu: /yocto/build)
$ runqemu qemux86-64 core-image-minimal
other window open for qemu and image runs well.
Problem
After using first time when i close the terminal, and use it again by running $ runqemu qemux86-64 core-image-minimal in (ubuntu: /yocto/build) error pops up runqemu: command not found and if i write bitbake in poky directory same error pops up bitbake: command not found.
NOTE: i have repeat this whole process 3 times to check if the installation is not correct but i have done everything fine from my side.
yocto project hierarchy:
If you close your poky environment terminal you always MUST re-source the environment.
The poky's oe-init-build-env setups up all commands for you, for instance:
runqemu* commands which are present in poky/scripts.
The script also export bitbake* commands from poky/bitbake/bin.
The line responsible for that is in:
poky/scripts/oe-buildenv-internal (line 99):
# Make sure our paths are at the beginning of $PATH
for newpath in "$BITBAKEDIR/bin" "$OEROOT/scripts"; do
# Remove any existences of $newpath from $PATH
PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\2#g;s#^:##")
# Add $newpath to $PATH
PATH="$newpath:$PATH"
done
So, always if you open new terminal:
source /yocto/source/poky/oe-init-build-env /yoctu/build
EDIT
If you already have a build folder, make sure to provide the right path for that folder to the oe-init-build-env script.
If you provide new path to non-existing folder, than the script will create another build for you.
EDIT2
To source poky environment according to your path:
Relative:
cd ~/Documents/yocto/source/poky
source oe-init-build-env build
^
|
(because build is in same folder as the script)
Absolute:
source /home/$USER/Documents/yocto/source/poky/oe-init-build-env /home/$USER/Documents/yocto/source/poky/build
THE RULE
source <path/to/oe-init-build-env> <path/to/build/folder>
If <path/to/build/folder> exists then, poky will source the existing build environment.
If <path/to/build/folder> does not exist, poky will create new build under the same name and path.

How to properly install GO with paths and all?

I have installed GO, setup the paths but when i run a file i get this error:
error!! exec: "sqlboiler": executable file not found in $PATH
exec: "sqlboiler": executable file not found in $PATH
exec: "sqlboiler": executable file not found in $PATH
exit status 3
What is going wrong?
The installation instructions are good, https://go.dev/doc/install. However, for me un Ubuntu 20.4 in wsl2, the suggested path for the binaries wasn't enough. Only go and gofmt are added to /usr/local/go/bin.
I did add the below to my .bashrc, since go install puts the binaries in this location on my system.
export PATH="$HOME/go/bin:$PATH"
Note, that the path to the binaries may differ on your system, so you have to adjust it accordingly.
Any binary you install with go install that is added to this path will be available to your shell afterwards.
For example:
$ go install github.com/volatiletech/sqlboiler/v4#latest
$ go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql#latest
$ whereis sqlboiler
sqlboiler: /home/blue/go/bin/sqlboiler
Potentially, you also need some database packages to your system. I am not sure on this any more. For example, you could add some Postgres libs if you are using Postgres. You have to see if it works without.
apt-get install postgresql-client-common postgresql-client-12
How to properly install GO with paths and all?
Install Go with the installer (Windows) or archive (extract into /usr/local on Linux/Mac).
When installing from archive, manually add the directory path where the go binary is located (/usr/local/go) to PATH.
Set GOPATH to a directory path wherein to contain bin, pkg and src sub-directories.
Add ${GOPATH}/bin to PATH.
What is going wrong?
The program you are running is trying to run the executable sqlboiler, which cannot be found in any of the directories specified in PATH.

Elasticsearch can't start on Windows Git Bash

I am trying to start Elasticsearch using the command bin/elasticsearch but I'm getting an error that says Could not find or load main class org.elasticsearch.bootstrap.Elasticsearch as shown below.
me#DESKTOP-T11JTA5 MINGW64 ~/elasticsearch-1.3.4
$ pwd
/c/Users/jacky/elasticsearch-1.3.4
me#DESKTOP-T11JTA5 MINGW64 ~/elasticsearch-1.3.4
$ ls
bin/ config/ lib/ LICENSE.txt NOTICE.txt README.textile
me#DESKTOP-T11JTA5 MINGW64 ~/elasticsearch-1.3.4
$ bin/elasticsearch
Error: Could not find or load main class org.elasticsearch.bootstrap.Elasticsearch
Probably your JAVA_HOME is not pointing at your JRE 1.7 directory.
Try something like:
set JAVA_HOME=C:\Program Files\Java\jre7
Of course, changing the path to your real Java instalation path. If you don't, install Oracle's Java 1.7

How can I prepend a directory to PATH using RVM on a per project basis?

RVM supports .ruby-version and .ruby-gemset on a per project basis and ensures those are set correctly when you navigate to a directory containing those files.
Is there a similar construct I can use for adding directories to my environment PATH variable using RVM?
I haven't found a way to do this using RVM, but I came across another project called direnv that accomplishes exactly what I want.
Here are the steps I took to prepend ./bin to my environment PATH variable on OSX every time I go to my project directory in the shell:
brew install direnv
Add eval "$(direnv hook $0)" to the end of my .zshrc file.
Create a .envrc file in the root of my project with the following content:
PATH_add bin

Error "cannot download, $GOPATH not set."

Setup:
Have a look at my configuration:
$ echo $GOPATH && ls -r $GOPATH
/home/cyrus/.go
src pkg bin
$ echo $GOROOT && ls $GOROOT
/usr/local/go
api AUTHORS bin CONTRIBUTORS doc favicon.ico include lib LICENSE misc PATENTS pkg README robots.txt src test VERSION
You can see that I've set a path for $GOPATH. In addition, I've created subdirectories that I may not need.
Question:
Why does the following command generate this error message?
$ go get code.google.com/p/go-tour/gotour
package code.google.com/p/go-tour/gotour: cannot download, $GOPATH not set. For more details see: go help gopath
If you set a variable like this:
GOPATH=$HOME/go
It won't be exported to any subprocesses. It's only available to that process. If you want to export it to subprocesses, use export:
export GOPATH
You can also combine the assignment and export:
export GOPATH=$HOME/go
My $GOROOT directory was created with owner: root and group: wheel instead having me as the owner and admin as the group. I'll guess that I used sudo when I shouldn't have (or some tool did it for me). As such go get could not write the packages to $GOROOT and hence the $GOPATH not set and permission denied errors.
By using chown and chgrp on my $GOROOT (with -R to get subfolders) 'go get...' worked. In my case VS Code was now able to install the Go components I was after.
When you run go env, you should be able to see if your GOPATH has been set.
On my case though, this command solves it when I had it run on my terminal.
export GOPATH=/usr/local/bin
i had setup GOPATH and it showed correctly with command go env. i had to give the correct permissions to the go directory using chmod and install gb by go get github.com/constabulary/gb/....
First do a `go env' and check the path GOROOT. Accordingly set the GOPATH.
In my case, it had to set GOPATH to /usr/lib/go. Earlier i tried it with /usr/share/go and /usr/bin/go but it didn't work.
$GOPATH should be your current workspace , a folder where your project resides.
or just cd ~/go and try to run those commands.
Or you can just update $GOPATH in ~/.bashrc or ~/.bashrc_profile on ubuntu

Resources