node-gyp build from different directory - node-gyp

whenever i do
node-gyp build
i need to be in the directory that has my binding.gyp 'build' directory.
I was wondering if there is a way where my current working directory could be somewhere else and I could specify the path to build at.
My use case is I spend most of my time in the working directory ~, where i like stop/start/restart node and i dont really want to 'cd' to 'api/v1/C' (which is where I keep my .c files) every time i want to build them.
(i suppose i could just write a script that does 'cd' to my 'api/v1/C', runs node-gyp build, then 'cd ~', however i'd like to know if there is another way without making a script)

In the docs:
-C $dir, --directory=$dir Run command in different directory

Related

'mongo' is still not working on PowerShell after doing all recommended things

I installed MongoDB and tried to run it on terminal. It just shows up 'mongo' is not recognized as an internal or external command, operable program or batch file.
I have set the path to bin folder inside Environment variables too. One thing I noticed is I might have a missing file inside bin folder and that is mongo. Because I have mongod and mongos file inside the bin folder. I tried to uninstall and reinstall the program and it was still not working.
I have no idea it's what that I'm missing. Please help out
Finally I have found the solution,
Mongo shell no longer ships with server binaries. We can download it from MongoDB Shell Download
Then we should extract the contents of the bin from the downloaded zip file to the bin file of the MongoDB folder and run mongosh instead of mongo on the terminal

Trying to find a failing React application build parameter when running yarn

I am forking a React app. I am trying to simply compile the open source code and run it Locally on my PC. I am using yarn command in PowerShell. Everything goes perfectly fine, installs all node modules, and at the very end gives me Error Code 1, $ rm -rf not a recognized command or batch file. So, there is a build parameter somewhere with the commands of $ rm -rf which is failing due to me doing this on Windows 10, and those being Linux commands. So, I think I can just simply find this parameter and change it to the Windows equivalent, or possible remove it entirely, but I have no idea where this build parameter is.
It is not in package.json, it's not in about 50 files I've opened and searched for it with Ctrl+F. I can't find it anywhere.
How do I figure out where this command is? What files does yarn reference besides package.json, package-lock.json, etc.? This is the only thing making it not compile/build.
I am aware there are certain ways to use this command in Windows, like with a Linux VM etc., but I'd rather understand the problem and solve it.

How do I run only some makefile commands as root?

I have an install target in my Makefile and wish to run some commands that install shared libraries(requires root permissions) and some that install config files into $HOME/.config
Usually I'd just tell the user to run sudo make install, however that results in the config file being installed to /root/.config instead of the actual users config directory.
How do I work around this issue?
Thanks alot.
You can just change the owner and permissions of the config files, although a Makefile that installs per user configuration files, is not a good idea because it would ideally need to find out how many users exist on the system to install the files for each user.
If you use the install command, you could even do
install -v -m644 -o$(USERNAME) -g$(USERGROUP) $(FILE) $(USERHOME)/.config/$(FILE)
A better approach would be to let the program install the default config files from a system wide directory when it doesn't find them, for example
/usr/share/my-application/default-config/config.conf
and then the program would search for the files in the appropriate directoy and copy them to the $HOME directory of the user that is currently running the program, that if the files are modifiable by the user, otherwise you just access them from their system-wide location.

Jenkins delete files from Workspace

I have jenkin's job, which copy tar file from linux user folder and then copy binary file (compiled) from another job and make new tar file. Then jenkins user can copy that new tar file from jenkin's workspace.
It doesn't build anything or take files from SCM. Then after a while, suddenly tar file has been deleted from workspace, I have to run job again. How I can prevent that?
You really shouldn't rely on your workspace existing after a job has completed, as the workspace can be overwritten by another build starting, or when someone deletes a build, by a slave going offline, etc...
Since you want to save the file for later use, you should use the "Archive the artifacts" option in your job's post-build configuration. If you enter **/*.tar, for example, Jenkins would save all TAR files at the end of the build.
Then you can use Jenkins' permalinks to access the artifacts, e.g.:
http://JENKINS/job/JOB_NAME/lastSuccessfulBuild/artifact/bin/my-app.tar
As the URL suggests, this would give you the file from the last successful build.
As a sidenote, if you then want to copy archived files to another build, the best way to do this is with the Copy Artifact plugin.
That way Jenkins handles the file copying for you, even across multiple Jenkins slaves, and you don't have to do anything nasty like hard-coding paths to other Jenkins workspaces.

Make/make install to custom directory

I am trying to install this to my webserver, which I have through a shared hosting company. In the installation instructions, it tells me to navigate to the program's directory, then use the shell commands ./configure, make, and make install to install the program. When I enter ./configure, everything executes fine. But when I enter make, it says
cd . && /bin/sh /home/blahblahname/swirl-1.1.0/config/missing --run aclocal-1.10
/home/blahblahname/swirl-1.1.0/config/missing: line 54:
aclocal-1.10: command not found WARNING: `aclocal-1.10' is missing on
your system. You should only need it if
you modified `acinclude.m4' or `configure.ac'. You might want
to install the `Automake' and `Perl' packages. Grab them from
any GNU archive site.
cd . && /bin/sh /home/blahblahname/swirl-1.1.0/config/missing --run automake-1.10 --gnu
/home/blahblahname/swirl-1.1.0/config/missing: line 54: automake-1.10: command not found
WARNING: `automake-1.10' is missing on your system. You should only need it if
you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
You might want to install the `Automake' and `Perl' packages.
Grab them from any GNU archive site.
/home/blahblahname/swirl-1.1.0/config/missing: line 185:
/usr/bin/find: Permission denied
cd . && /bin/sh /home/blahblahname/swirl-1.1.0/config/missing --run autoconf autoconf:
configure.in: No such file or directory make: *** [configure] Error 1
Same thing with make install. It looks like I don't have access to the directory it's trying to install to. Is there a way I can get this to work without access to that directory? Maybe I can set a custom make/make install location somehow?

Resources