Error while trying to create a Node.Js symlink

Asked

Viewed 90 times

1

I am trying to run the creation of a symbolic link on Node.Js however, I am getting error 'EPERM' when running the script.

Script:

const fs = require('fs');
const path = require('path');
let absolute_source = path.resolve('./assets/');
let absolute_target = path.resolve('./public');

fs.symlink(
    absolute_source
    , absolute_target+'/assets'
    , function (err) {
        console.log(err || "Done.");
    }
);

Error:

[Error: EPERM: operation not permitted, symlink 'C:\xampp\htdocs\projetoNode\01_projeto\assets' -> 'C:\xampp\htdocs\projetoNode\01_projeto\public\assets'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'symlink',
  path: 'C:\\xampp\\htdocs\\projetoNode\\01_projeto\\assets',
  dest: 'C:\\xampp\\htdocs\\projetoNode\\01_projeto\\public\\assets'
}

I’ve looked at the permissions are ok, I’ve also looked at if it’s read-only and it’s not.

What could be the cause of this mistake and what I can do to fix it?

Note: I use:

  • Windows 10 pro
  • Node.Js 6.14.6.
  • Dude. as I recall, windows does not have a symbology link. This is a limitation of windows file system NTFS. But I do not use windows I have no property to speak.

  • Worse than in Windows I can create the symbolic link and wanted to do the same by Node.js to avoid having to create everything in the public folder, however, I could not make Fs create...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.