Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.
Description
- Version: v13.4.0
- Platform: darwin
- Subsystem: fs
> fs.mkdirSync('/var/this/fails',{recursive: true }) at Object.mkdirSync (fs.js:854:3){errno: -2, syscall: 'mkdir', code: 'ENOENT', path: '/var/this/fails' } > fs.mkdir('/var/this/fails',{recursive: true }, console.error) undefined > [Error: ENOENT: no such file or directory, mkdir]{errno: -2, code: 'ENOENT', syscall: 'mkdir' } Problems with this error:
- No path is provided in the async version. (Reported in missing error.path at fs.mkdir callback on last call #28015)
- Error code is
ENOENTwhen it should beEACCES. - Error errno is -2 when it should be -13.
A manual recursive implementation (like make-dir or mkdirp) will fail when it hits this:
> fs.mkdirSync('/var/this',{recursive: false }) Uncaught Error: EACCES: permission denied, mkdir '/var/this' at Object.mkdirSync (fs.js:854:3){errno: -13, syscall: 'mkdir', code: 'EACCES', path: '/var/this' } > fs.mkdir('/var/this',{recursive: false }, console.error) undefined > [Error: EACCES: permission denied, mkdir '/var/this']{errno: -13, code: 'EACCES', syscall: 'mkdir', path: '/var/this' } Note that the recursive: true implementation will fail in the same way with ENOENT even if the parent path does in fact exist and the syscall is failing with EACCES:
> fs.mkdirSync('/var/this',{recursive: true }) Uncaught Error: ENOENT: no such file or directory, mkdir '/var/this' at Object.mkdirSync (fs.js:854:3){errno: -2, syscall: 'mkdir', code: 'ENOENT', path: '/var/this' > fs.mkdir('/var/this',{recursive: true }, console.error) undefined > [Error: ENOENT: no such file or directory, mkdir]{errno: -2, code: 'ENOENT', syscall: 'mkdir' } Metadata
Metadata
Assignees
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.