Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix EACCES: permission denied, open

I see the following error when executing npm install -g serverless via buildspec.yml from AWS Codebuild

[email protected] postinstall /usr/local/lib/node_modules/serverless/node_modules/storage-engine node ./compatibility/detect.js

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/serverless/node_modules/storage-engine/lib/compatibility/index.js'

like image 757
Sachin Chandorkar Avatar asked Jun 21 '20 20:06

Sachin Chandorkar


People also ask

How do I give npm permission to install?

Run “npm config get prefix” in your terminal. This will give the path of global node_modules: For ex: /usr/local. Change the user permissions for this folder by using following command: sudo chown -R <user_id> /usr/local/

How do I fix npm install error?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).

How do I use sudo access in npm?

always use sudo -i or sudo -H when running npm install to install global packages. When you use npm , it downloads packages to your user home directory. When you run as sudo, npm installs files to the same directory, but now they are owned by root.

What is NPX?

npx is a very powerful command that's been available in npm starting version 5.2, released in July 2017. If you don't want to install npm, you can install npx as a standalone package. npx lets you run code built with Node. js and published through the npm registry.

Why am I getting EACCES permission denied in NPM err?

For instance, running the following command ‘ npm install -g expo-cli ’ returns you with — npm ERR! Error: EACCES: permission denied… … …. 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!

How do I fix the EACCES error when installing a package?

If you see an EACCES error when you try to install a package globally, you can either: Reinstall npm with a node version manager (recommended), This is the best way to avoid permissions issues.

How can I avoid permissions issues when reinstalling NPM?

This is the best way to avoid permissions issues. To reinstall npm with a node version manager, follow the steps in " Downloading and installing Node.js and npm ". You do not need to remove your current version of npm or Node.js before installing a node version manager. Note: This section does not apply to Microsoft Windows.


Video Answer


1 Answers

Used yarn instead of npm.

yarn global add serverless
like image 63
eibay Avatar answered Sep 24 '22 01:09

eibay