Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix permission error while installing Parcel Bundler with terminal

while installing parcel module in nodeJS, via terminal on Mac OS i am getting permission error. error: checkPermission Missing write access to /usr/local/lib/node_modules

i am new at learning Node Modules. i tried installing(Node , NPM) everything works perfect. but first time installing node module it throwing error. i know its looking for directory of Windows type URL but i don't know how to fix it for mac.

iMac:~ hassan$ node -v
v11.10.0 
iMac:~ hassan$ npm -v
6.7.0
iMac:~ hassan$ npm install -g parcel-bundler
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR!   stack:
npm ERR!    "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hassan/.npm/_logs/2019-04-23T13_13_46_848Z-debug.log

i want to install Parcel Bundler for Ui animation on my website.

like image 658
Abualhassan Avatar asked Nov 06 '22 18:11

Abualhassan


1 Answers

You'll need to have access to /usr/local/lib/node_modules as a super-admin has, to perform the global installation of parcel-bundler.

As mentionned in the comment and assuming your user is the list of sudoers for this computer, you can simply do :

sudo npm -g install parcel-bundler

If this is not the case, you'll need more permissions on the system to install Parcel. Then you'll be able to :

  • Add your user as a sudoers in the file sudoers.d (Be careful doing this ! See this tutorial for OSX).

  • Perform the operation directly as the super-admin of the computer.

I'd prefer the 1st option regarding the long-term administration and security of the computer itself. The other option, while not recommended, is still possible for some cases.

Otherwise, you'll not have permission errors if you choose to install Parcel locally. In this case, just omit the -g flag while running the command (i.e npm install parcel-bundler). It will end up by adding parcel to your package.json file so that you'll be able to install it again later.

like image 107
JeuneApprenti Avatar answered Nov 14 '22 08:11

JeuneApprenti