-
Notifications
You must be signed in to change notification settings - Fork 306
Closed
Description
Version: 11.15.0
Platform: Darwin
const rmdirSync = (path, options) => {
if (options && options.recursive) {
let files = [];
if (fs.existsSync(path)) {
if(fs.statSync(path).isDirectory()){
files = fs.readdirSync(path);
for (const file of files) {
const currentPath = $path.resolve(path, file);
if (fs.statSync(currentPath).isDirectory()) {
rmdirSync(currentPath, options);
} else {
fs.unlinkSync(currentPath);
}
}
}
else{
fs.unlinkSync(path);
}
}
}
return fs.rmdirSync(path);
};when i use
fs.readdirSync('/project/node_modules/.bin')I get files with in /project/node_modules/.bin as following
[
'acorn', 'atob',
'babylon', 'browserslist',
'detect-libc', 'errno',
'import-local-fixture', 'jsesc',
'json5', 'loose-envify',
'mg-service', 'miller-rabin',
'mkdirp', 'needle',
'node-pre-gyp', 'nopt',
'parser', 'qrcode-terminal',
'rc', 'regjsparser',
'rimraf', 'semver',
'sha.js', 'terser',
'uuid', 'webpack',
'webpack-cli', 'which'
]
When I open the directory .bin, there is no acorn in it
[
'atob',
'babylon', 'browserslist',
'detect-libc', 'errno',
'import-local-fixture', 'jsesc',
'json5', 'loose-envify',
'mg-service', 'miller-rabin',
'mkdirp', 'needle',
'node-pre-gyp', 'nopt',
'parser', 'qrcode-terminal',
'rc', 'regjsparser',
'rimraf', 'semver',
'sha.js', 'terser',
'uuid', 'webpack',
'webpack-cli', 'which'
]
as I do this:
rmdirSync($path.resolve(__dirname,"..","projects","test-empty","node_modules"),{recursive:true})there is a Error: ENOTEMPTY: directory not empty, rmdir '/project/test-empty/node_modules/.bin'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels