I was chatting with a student today who couldn't figure out why his scripts wouldn't run. He was doing everything correctly, but still the commands failed with a bizarre error. I asked to see the output. Here's an approximation:
PS C:\Users\student\OneDrive\Computer Programming\Assignments & Tests\assignment4> npm run server 'Tests\assignment4\node_modules\.bin\' is not recognized as an internal or external command, operable program or batch file. internal/modules/cjs/loader.js:969 throw err; ^
The error here stems from the pathname, which contains an
&. In many shells, including PowerShell, this will often get interpreted as part of the shell command vs. the filename. You can see the error message above referring to the portion of the path after the &, ignoring everything before it.
It's not an obvious problem until, and unless you know about using
& in shell commands. I also think that the proliferation of non-filesystem naming in tools like Google Docs and the like, contributes to a sense that a pathname can be any text you want. After all, typing an & in the title of a Word Doc isn't a problem, why should it be in a file path?
Paths, filenames, URLs, and other technical naming formats are not the place to get creative with your use of the keyboard. You want to keep things boring: lowercase (looking at you, Apple), no spaces (looking at you, npm), no special characters. Keep it short. Keep it simple. Keep it boring.