question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Leading $ in filename fails to locate file.

See original GitHub issue
  • nodemon -v: 2.0.7
  • node -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:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
RaisinTencommented, Apr 3, 2021

Consider escaping the $ by prepending it with a \ like nodemon \$myFile.js.

0reactions
remycommented, Jul 9, 2021

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 write echo "Hello $USER" it will swap $USER for 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found