Leading $ in filename fails to locate file.
See original GitHub issuenodemon -v: 2.0.7node -v: v15.11.0- Operating system/terminal environment: Lubuntu
- Using Docker? What image: N/a
- Command you ran: (Specified below)
Expected behaviour
nodemon "$myFile.js" -> [nodemon] starting 'node $myFile.js'
Should run the filename specified.
Actual behaviour
nodemon "$myFile.js" -> [nodemon] starting 'node .js'
Trims all but the extension and fails to locate the file.
Steps to reproduce
Create a file with a leading $ (dollar sign) and attempt to run it. I assume it’s incorrectly identifying it as a regex expression?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Error message when you open or save a file in ...
This error message occurs when you save or open a file if the path to the file (including the file name) exceeds 218...
Read more >File Names with Leading Spaces are Improperly Stripped
If I try to deal with this 'conflict' by renaming it in the desktop client, it fails: "Could not rename local file. Source...
Read more >Remove leading spaces in Windows file names [closed]
We loop through all subfolders with /R option. We want to find all files starting with a space, so we specify it in...
Read more >FILE NAMES CONTAINING LEADING/TRAILING SPACES ...
In OIT 8.4.1 if the file name passed in for text extraction contains leading/trailing spaces taken "as is", no whitepace is stripped and...
Read more >Error: Can't find the file: “[path\FileName]”. Mak...
Check that the file is in the expected location. Verify that the file name has been specified accurately, including file type extension. Next, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Consider escaping the
$by prepending it with a\likenodemon \$myFile.js.Like @RaisinTen said, you need to escape your
$string - it’s because your shell environment is trying to replace it with an environment variable. Similarly to how I might writeecho "Hello $USER"it will swap$USERfor my currently logged in user.As it was noted, this isn’t an issue with nodemon, and it might be wise to avoid using
$in filenames in general as it’ll bite you elsewhere down the chain.