SQL Installation ~/.bashrc "No such file or directory" then others

https://www.codecademy.com/paths/web-development/tracks/sql-for-web-development/modules/setting-up-sqlite/articles/what-is-sqlite

Initially when attempting to follow the instructions to install SQLite, I got down to “Setting up SQLite” for Windows at Step 3. I was able to get SQLite to launch successfully. When creating the alias, after entering the “source ~/.bashrc” command, bash would return “No such file or directory”.

Did some poking around here, found another windows user who had fixed their problem by putting ${PWD} in single quotes in the alias. Tried that and now I’m getting additional errors.

Tried uninstalling SQLite and starting from scratch, consistently getting this error now. any help would be appreciated.

What is now in ~/.bashrc? You’re appending to the file so any pre-existing syntax errors would still cause problems. I’d suggest opening that file with a text editor and double checking the existing lines.

One of the big gotchas here might be the space in the path, if that’s not properly escaped or quoted then it’s treated like two separate arguments. If you’re already editing .bashrc then the following example would deal with a space-
alias sqlite3="winpty /c/User/user\ name/direc/src/sqlite3.exe"
* note the escaped space

It might be worth running sqlite in cmd or powershell instead of gitbash anyway. I’ve found winpty very useful but it did seem to have some quirks when I tried it with sqlite; usable, but some things weren’t quite right.

2 Likes

When any of the directories have spaces, I usually just use single quotes around the ${PWD} interpolation:

echo "alias sqlite3=\"winpty '${PWD}'/sqlite3.exe\"" >> ~/.bashrc
1 Like

Right, this was the advice I followed from another thread here that resulted in the message above. It used to just say “No such file or directory”. After attempting the same command with single quotes, now it has the other error messages “unexpected EOF…”, “unexpected end of file”

From other googling I’ve done, it seems like an issue with Windows 10 usernames containing spaces. I’ve had similar issues with other Codecademy projects requiring command line installs and have yet to find a consistent solution.

I wasn’t able to find anything in the directory with that file path, just following the instructions as given.

Well the error tells you that you either have an extra " somewhere or forgot to include a closing "

What you need to do is open your .bashrc and fix or delete that line. I think the best option is delete it and redo the command in bash.

Here’s how:

  • run nano ~/.bashrc and that should open it up in the in-terminal nano editor.
  • delete the line (the file will probably be blank now – if there are multiple lines for sqlite3 aliases, delete them all)
  • hit Ctrl + x to exit nano, and choose y when it asks if you want to save the changes.
  • now you should be back in regular old git bash.
  • Assuming you’re in the proper directory where your sqlite3.exe file is, copy and paste this command into git bash:
    echo "alias sqlite3=\"winpty '${PWD}'/sqlite3.exe\"" >> ~/.bashrc
    
    • note: if pasting isn’t working in Git Bash, try Ctrl + Shift + v. If that doesn’t work, you may need to enable it in the Git Bash settings, which you can get to by right-clicking the top bar of the Git Bash window and selecting “options”
  • then either run source ~/.bashrc or close and reopen Git Bash.

After that, your sqlite3 alias should work.

2 Likes

Thank you for the detailed answer, this solved my problem.

1 Like