gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/serverless/node_modules/snappy/.node-gyp' - serverless-framework

I have an AWS CodeBuild Project which tries to install serverless framework but returns an error in the title however it says framework successfully installed. My understanding is that this fails to install the snappy module. Why is that and how can I resolve this?
The command I run in my buildspec.yaml is:
npm install -g serverless
And my user is:
/root

in the first error line:
gyp WARN EACCES current user ("nobody")...
seems node-gyp is trying to use another user instead of root,
we can find the issue discussed in the package repository:
https://github.com/nodejs/node-gyp/issues/1236
the most recent solutions seems to be:
npm_config_user=root npm install -g ...
to force/set the environment user to be used by npm install process

Related

Unable to install yarn through npm

I am trying to install yarn through npm on Mac by referring the documentation given here: https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable
npm install --global yarn
However when I run this command in terminal, I am getting the following error and the package is not being installed
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
I also ran this command but nothing happened. I am also seeing messages like - this operation was rejected by your operating system. I haven't used yarn in a year, and everything was working fine, but suddenly I am running into all this. Would love to know what I am doing wrong here and how I can resolve this.
This the error message that comes
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.
sudo npm install --location=global yarn
This command worked for me
As warning messages indicate, global -global and -local appear to be deprecated. However, instead of global, you can use the -location=global command.
-global and -local is deprecated.
Use This command:
npm install --location=global create-react-app
Instead of:
npm install -g create-react-app

I can't install anything with npm command line

I have been using npm for some time with ionic. Recently, it started giving an error when trying to install anything both packages and modules. Even with react native it gives the same error.
I have tried re-installing it, but that didn't fix it. I created a new user on my Windows system, but it's still not working, and I noticed that when I search for the error code on Google, I get no results.
C:\WINDOWS\system32>npm install -g ionic
npm ERR! error:0909006C:PEM routines:get_name:no start line
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\OLAMIDE AWOBUSUYI\AppData\Roaming\npm-cache_logs\2019-07-11T19_47_18_673Z-debug.logenter image description here
Try to set the npm registry:
npm set registry http://registry.npmjs.org/

Missing write access error on nativescript install

When I attempt to install nativescrtipt by running npm i -g nativescript, I receive the following error:
npm WARN checkPermissions Missing write access to
/usr/local/lib/node_modules/nativescript
npm ERR! path /usr/local/lib/node_modules/nativescript
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access
'/usr/local/lib/node_modules/nativescript'
npm ERR! enoent This is related to npm not being able to find a
file.
I have tried to run the command as sudo and receive the same result. I also attempted to add write permission to the node_modules directory.
I am running node v10.6.0 on macOS High Sierra.
Add sudo command to allow you run the program with security privilege
sudo npm i -g nativescript
I followed this link: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally to resolve the issue.
I installed nvm and updated to the latest version of node. Then, the command npm i -g nativescript successfully installed the nativescript-cli.
The issue does not appear to be coming from nativescript, but an issue with my node installation.
Run the following command sudo npm i -g nativescript
This will forcefully with security permission install the missing scripts to run the npm command again with no bugs or warnings

Error when yarn add and npm i

Good evening!
i'm trying to add some packages to my native react application but it's not working with either npm or yarn. i have uninstalled and reinstalled yarn but it has not changed anything
I use Windows 10.
for yarn :
yarn add react-navigation
yarn add v1.5.1
[1/4] Resolving packages...
error An unexpected error occurred: "Couldn't find the binary git".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Boubacar\\Desktop\\blob\\essai\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
for npm :
npm i react-navigation
npm ERR! code ENOGIT
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Boubacar\AppData\Roaming\npm-cache\_logs\2018-04-08T00_02_28_158Z-debug.log.
Help me please!
The console log is plain and clear.
error An unexpected error occurred: "Couldn't find the binary git".
Check/Install Git on your system.
For Windows users, need to set environment path, like
C:\Program Files\Git\cmd

How to install Yeoman on an Openshift Tomcat server

I have a Java spring as server stack and with angularJS for the UI stack.
Part of the build process I need Jenkins to run Grunt build to optimize the UI before the build process starts.
I have tried to install Yeoman on the Jenkins instance but since I am not the administrator I am getting Access errors.
[\> npm install -g yo
npm ERR! Error: EACCES, mkdir '/var/lib/openshift/<ID>/.npm'
npm ERR! { [Error: EACCES, mkdir '/var/lib/openshift/<ID>/.npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/var/lib/openshift/<ID>/.npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
You're getting an access error because you're trying to do a global install - that's what the -g flag does. In other words, you're attempting to install yeoman in a system-wide location instead of locally, which requires root permissions.
Also, you shouldn't need to install yeoman in a production environment - yeoman just does app scaffolding. If you're using yeoman locally, it should have added grunt, and any grunt plugins you need, to the package.json file in your app. Make sure the package.json file is checked in, then as part of the build process, you can run npm install, then grunt build.
I'm not sure how Jenkins affects the build process, but normally, npm install will run automatically when you push a new commit to your OpenShift app.