D
D
Dvorak2016-04-18 00:48:45
JavaScript
Dvorak, 2016-04-18 00:48:45

Why can't I create a folder with Node.js?

Wrote this code:

var fs=require('fs');
fs.mkdirSync('myFolder');

I see the following in the console:
fs.js:647
return binding.mkdir(pathModule._makeLong(path),
^
Error: EEXIST, file already exists 'myFolder'
at Object.fs.mkdirSync (fs.js:647:18)
at Object .(/home/user/main.js:14:4)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-04-18
@allishappy

file already exists 'myFolder' - the folder/file already exists, sort of

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question