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.

"no such file or directory" Doesn't Show Errant File/Directory Path

See original GitHub issue

I just got the following error from memory-fs:

Error: no such file or directory
    at MemoryFileSystem.readFileSync (/myproject/node_modules/memory-fs/lib/MemoryFileSystem.js:108:10)
    at MemoryFileSystem.readFile (/myproject/node_modules/memory-fs/lib/MemoryFileSystem.js:298:21)
    at devRoute (/myproject/backend/webpack.js:36:29)
    at Layer.handle [as handle_request] (/myproject/node_modules/express/lib/router/layer.js:95:5)
    at next (/myproject/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/myproject/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/myproject/node_modules/express/lib/router/layer.js:95:5)
    at /myproject/node_modules/express/lib/router/index.js:277:22
    at Function.process_params (/myproject/node_modules/express/lib/router/index.js:330:12)
    at next (/myproject/node_modules/express/lib/router/index.js:271:10)
    at Layer.handle [as handle_request] (/myproject/node_modules/express/lib/router/layer.js:91:12)
    at trim_prefix (/myproject/node_modules/express/lib/router/index.js:312:13)
    at /myproject/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/myproject/node_modules/express/lib/router/index.js:330:12)
    at next (/myproject/node_modules/express/lib/router/index.js:271:10)
    at SendStream.error (/myproject/node_modules/serve-static/index.js:121:7)

As you can see, there’s no mention of the path it was trying to use to find a file/directory. However, when I looked at the code it was clear that it intended to share that path:

if(!isDir(current[path[i]])) 
    throw new MemoryFileSystemError(errors.code.ENOENT, _path); // Note the ",  _path"

and indeed, if I added a console .log …

if(!isDir(current[path[i]])) console.log(_path)

it logged the path successfully. So evidently there’s something wrong with MemoryFileSystemError which is causing it to ignore or discard it’s second argument.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
CyanChoicommented, Jul 24, 2019

same error … somebody help …

0reactions
DimuthRuwanthacommented, May 17, 2020

same error … somebody help …

I had the same issue and after I removed yarn.lock file and install modules again fixed it

Read more comments on GitHub >

github_iconTop Results From Across the Web

fatal: Unable to read current working directory: No such file or ...
When run from a non-main worktree, setup_git_directory() will note that the discovered git directory (/PATH/TO/.git/worktree/non-main-worktree) ...
Read more >
How is "No such file or directory" getting added to my PATH ...
The problem isn't with your PATH , it's with how you're trying to display it. The first thing in a command line is...
Read more >
error no such file or directory - General - RStudio Community
Hi,. Welcome to the RStudio community! You either have to use the pull path name (e.g. from the root of your computer) or...
Read more >
Navigating Files and Directories - Data Carpentry
The full path tells you where a directory is in that hierarchy. Navigate to the home directory, then enter the pwd command. $...
Read more >
FileNotFoundError: [Errno 2] No such file or directory
In the above code, you are not giving the full path to a file to the open() function, just its name - a...
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