How to Solve Error Message Error: EPERM: operation not permitted in NodeJS Application

Posted on

Introduction

This article will show how to solve an error message upon executing a NodeJS application. The error message is in the title of this article. Actually, the following is the error message in a full command execution :

[root@10 crud]# npm install express --save
npm ERR! code EPERM
npm ERR! syscall symlink
npm ERR! path ../mime/cli.js
npm ERR! dest /media/sf_windows/nodejs/crud/node_modules/.bin/mime
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../mime/cli.js' -> '/media/sf_windows/nodejs/crud/node_modules/.bin/mime'
npm ERR!  [Error: EPERM: operation not permitted, symlink '../mime/cli.js' -> '/media/sf_windows/nodejs/crud/node_modules/.bin/mime'] {
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../mime/cli.js',
npm ERR!   dest: '/media/sf_windows/nodejs/crud/node_modules/.bin/mime'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-03-04T13_56_55_817Z-debug.log
[root@10 crud]#

Solution

Actually, the error in this article has a relation with the previous article. The article has a title of ‘How to Solve Error Message no such file or directory, open ‘package.json’ in NodeJS’ in this link. So, basically the answer is simple. The answer is just use a normal physical storage. Briefly, the above error appear when the execution of the command exist in a mounted folder. Furthermore, the mounted folder actually exist physically in a host machine running using Windows operating system. Apparently, executing the command in a guest machine running using Linux CentOS 8 in a virtual server end up failing. So, there is a certain permission aspect blocking the execution command in a mounted folder where it exist physically in the host machine running using Windows operating system.

3 thoughts on “How to Solve Error Message Error: EPERM: operation not permitted in NodeJS Application

  1. this is the worst advice I have ever read. “getting a permissions error? just dont use the network drive, simple.”

    1. Thanks for the comment. Well, actually it is a long explanation for informing that using a mounted physical folder in an operating system runnning in the VirtualBox will end up in failure for installing NodeJS express. The possible cause is the permission error for using that mounted physical folder. Hoping that the project can be persisted in the physical folder of the host instead of the folder exist in the virtual operating system. Unfortunately ends in a failure.

Leave a Reply