Problem running package in directory with whitespace on windows 10 - windows

Through the terminal I ran
yarn create xxxxxxx-app in a directory that had whitespace in the URL, but it failed because it couldn't understand the complete URL. So I changed to a directory that didn't have any spaces in it to run the same command and it failed using the same internal path as the previous.
The package installs the scripts and binaries where it should but when it tries to run them, it tries to use the original URL that has the whitespace and fails
Example in a directory with or without whitespace:
runs: C:\Users\First Last\AppData\Local\Yarn\bin\xxxxxxxxx-app
"C:\Users\First" isn't recognized as an internal or external command,
error Command failed.
So internally it uses the same command as the one that failed orginially even though it was run in another directory
both respond as follows:
Exit code: 1
Command: C:\Users\First Last\AppData\Local\Yarn\bin\xxxxxxxxxx-app
Arguments: ./xxxxxxxblog
Directory: C:\Users\First_Last\Github\David-Ventures1

I found that the problem is that the package uses my user account no matter where I try to run the script, and unfortunately my user directory has whitespace in it.
So I need to remove the whitespace.... I tried a couple of times a little while ago but nearly bricked my computer...

Related

Yarn throws an error while trying to build electron app

When I try to create an electron app via yarn create electron-app "my-app", it throws an error saying
'C:\Users\Lincoln' is not recognized as an internal or external command,
operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\Users\Lincoln Muller\AppData\Local\Yarn\bin\create-electron-app
Arguments: my-app
Directory: C:\Users\Lincoln Muller
Output:
What should I do? I'm new to Yarn, and NPM worked fine. This also only happens on Windows, when I use my iMac on Monterey or my Linux laptop the command runs fine.
It seems that Yarn assumes it can run the program create-electron-app without considering spaces in the file path. Unfortunately, this does not work and only the part up to the first space is considered a program to run, hence you get the error message that C:\Users\Lincoln is not a valid command.
The problem is discussed in this Yarn issue. The key idea in the workarounds is to accept Yarn's behavior and give it a file path that doesn't contain spaces. There are two concrete ideas:
Option A - Use directory name abbreviation to skip the space
yarn config set cache-folder "C:\Users\Lincol~1\AppData\Local\Yarn\Cache"
yarn config set prefix "C:\Users\Lincol~1\AppData\Local\Yarn"
For this to work, make sure to take 6 characters from the actual directory name and then append ~1. If the space happens to occur within the first 6 characters, this approach will not work for you.
Option B - Make another user folder, skipping the space (using junction)
mklink /J "C:\Users\Lincoln-Muller" "C:\Users\Lincoln Muller"
yarn config set cache-folder "C:\Users\Lincoln-Muller\AppData\Local\Yarn\Cache"
yarn config set prefix "C:\Users\Lincoln-Muller\AppData\Local\Yarn"
A junction allows two directory names to point at the same file system structure. That means that there are two ways to address the same directory. Their contents cannot diverge because they are the same directory.
The issue is that you have a space in your directory name and you haven't correctly escaped it.
C:\Users\Lincoln Muller
This looks like you are trying to pass the parameter Muller to program C:\Users\Lincoln
I suggest just using a folder that doesn't contain spaces or escape the [space character].
https://www.howtogeek.com/694949/how-to-escape-spaces-in-file-paths-on-the-windows-command-line/
Three Ways to Escape Spaces on Windows There are three different ways
you can escape file paths on Windows:
By enclosing the path (or parts of it) in double quotation marks ( ”
).
By adding a caret character ( ^ ) before each space. (This only
works in Command Prompt/CMD, and it doesn’t seem to work with every
command.)
By adding a grave accent character ( ` ) before each space.
(This only works in PowerShell, but it always works.)

Job not running: 'No such file or directory' but the script exists

I'm a bioinformatician, new in the community and quite new about working with bash-commands.
I recently encountered a very trivial error message but for me the issue is a bit complex to fix.
Briefly, when I launch a script with the qsub command (from the master node ) the job does not work and I find the following error message in the 'log' file:
Fatal error: cannot open file
'/data/users/genethongandolfi/scripts/multi454.mse/multi454fasta.manip.r':
No such file or directory
This sounds quite strange for me since the path to the script file called 'multi454fasta.manip.r' is correct (I already checked with the 'find' command).
I also tried to move the script into the home directory /home/genethongandolfi/scripts and the error message changes: the job runs because the system finds the script, but not the input file in the usual path /data/users/genethongandolfi/analysis/etc... . It seems to be something for which the /data/users/... path is not recognized when I launch a job.
There are a couple of reasons why this could be the case:
The file location on the slave node is different from the master
The file permissions on the slave do not permit access to the file
If you can, try logging into the slave node, change to the user running the job, and check the file location and permissions.
Had the same error for a simple c program in form of an .exe
Removing the .exe from the shell script did eventually fix it.
So instead of ./program.exe write ./program

How to call a script in a subdirectory from Perl using system (Windows)

I have a base directory, call it MAIN and two subfolders, SCRIPTS and WORK.
When using the following line of code, the script calls upon the job and runs it, only if job_name is in the MAIN folder, then prints output or error to job_name.out/.err in the WORK folder.
system("$job_name > ./WORK/$job_name.out 2> ./WORK/$job_name.err");
If I move the jobs into SCRIPTS then I cannot seem to find an efficient/simple way to call upon it.. I figured something similar to the following code would work:
system("SCRIPTS/$job_name > ./WORK/$job_name.out 2> ./WORK/$job_name.err");
But I get errors like:
SCRIPTS is not recognized as an internal or external command......
The system cannot find the path specified.
How can I compose this command to get it to work from a subdirectory?
On Windows, filepaths are specified with backslashes (\).
Instead of system("SCRIPTS/$job_name"...), try system("SCRIPTS\\$job_name"...)

Command not found

I am quite new to the Mac Terminal environment.
I donwloaded sqlplus (which is recognised as a UNIX executable program) and then in Terminal I do cd a few times until I arrive in the folder I put this in (\Applications\instantclient_10) in this case.
When I type 'ls' I see a listing of all the files including the sqlplus. So I would then expect to simply type at the Telnet prompt 'sqlplus' and then this would start but instead keep getting
-bash: sqlplus: command not found
This is problem one.
I have now downloaded MySQL and again, when I go to the correct folder (\Library\StarupItems\MySQLCOM) and I type 'ls' I see my files (including MySQLCOM) but when I come to try to 'run' this by simply typing 'MySQLCOM' again the message is:
-base: MySQLCOM: command not found
What am I doing wrong?
Thanks
To run binary/executables in current folder you need to prefix them with ./
./sqlplus
The idea here is that you want to force execution of local file and not run it accidentally. Imagine app that would put ls binary into it's folder and it would automatically run if did ls in that folder.

Problem setting up github repository, touch not recognized in CMD

When I get to the step:
touch README
I get the error
'touch' is not recognized as an internal or external command, operable program or batch file.
What does this mean?
I'm in Win 7 Home Premium command prompt.
Make sure you're working in git bash, not cmd.
The touch command updates the last-modified timestamp of the file to the current time, or if the file doesn't already exist, creates an empty file with the given name. This command does not exist (by default) in Windows, which is the reason you get that error message.
To get past this step, you can create a file called README in whatever way you feel most comfortable with. For example, you could use notepad.exe if you have no better alternative available.
Use this code in CMD and then touch your file
npm install touch-cli -g

Resources