npm install -g surge then the respected error come up. please helps me to sort out this problem - node.js

name: CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
- uses: actions/checkout#v2
- name: Node js installation
uses: actions/setup-node#v2-beta
with:
versoin: 14
- name: Installing Surge
run: npm install --global surge
- name: Yarn Installation
uses: Borales/actions-yarn#v2.1.0
with:
cmd: install
- name: Start building ...
run: yarn build
- name: Deplying site on surge...
run: surge ./build http://practice_of_bootcamp.surge.sh --token ${{secrets.SURGE_TOKEN}}
when this workflow flows the respected error come into the scope
Run npm install --global surge
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
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! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
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! /home/runner/.npm/_logs/2020-11-05T05_49_12_767Z-debug.log
Error: Process completed with exit code 243.

This can be solved in two ways. Quickest would be to do sudo npm install -g surge. By using sudo, you're assuming root privileges temporarily. You may be asked for your user's password.
A much better way to solve this (and possibly never have this problem again) would be to install node version manager (nvm). This involves a few steps to set up, but it'll install every thing - node, npm and all the global npm modules, to your user's folder, not the system level folders like /usr/local.
This becomes much easier to manage, and it's easy to nuke a node version and start anew. What's more, you get the ability to install multiple node version, and switch between them easily for a particular project or for all projects.

Related

What should be done to have permits to join two modules of a project without using sudo?

I am trying to link two modules created by me, in a project created with Node.js, and as always I did: npm link . inside the module that I want to call, and from the other call it in package.json, and it gives me the following error:
npm ERR! path /home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '/home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db' -> '/usr/lib/node_modules/michaelgram-db'
npm ERR! { Error: EACCES: permission denied, symlink '/home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db' -> '/usr/lib/node_modules/michaelgram-db'
npm ERR! stack: 'Error: EACCES: permission denied, symlink \'/home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db\' -> \'/usr/lib/node_modules/michaelgram-db\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '/home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db',
npm ERR! dest: '/usr/lib/node_modules/michaelgram-db' }
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! /home/miguel/.npm/_logs/2018-07-17T12_02_46_081Z-debug.log
How should I install Node globally?
I have seen those files and they are owned by root. I put a new version of Ubuntu 18.04 I installed node Could it be problem when installing node? I do not remember how I did it, but on previous occasions I did not have this permission problem. I do not know if I should uninstall node and npm I have to install it in a way that I can access from any project I do. I already gave another file problems and I corregi using sudo, but it does not seem like a practice, because it should not give problems, never gave them node. What do you advise me to do to correct the problem and access node_modules without using sudo? Maybe I should uninstall and install it in another way? Thank you, I hope you understand my need, forgive the syntax but I must use the translator. Thank you.
I would advice you the 2 definitive ways given in the npm documenation
1)Reinstall npm with a version manager (recommended)
2)Change npm's default directory manually.
please visit https://docs.npmjs.com/getting-started/fixing-npm-permissions

Angular CLI cannot install errno -13

could anyone advise what I should do please?
My node and npm version as follows:
$ viviantekiMacBook-Air-2:~ Vivi1an$ node -v
v8.11.1
$ viviantekiMacBook-Air-2:~ Vivi1an$ npm -v
5.6.0
I tried to install Angular CLI by following the instructions on their website but I got an error after I typed in npm install -g #angular/cli
Error info as below:
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: '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! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Vivi1an/.npm/_logs/2018-04-02T09_00_20_531Z-debug.log
viviantekiMacBook-Air-2:~ Vivi1an$
I have downloaded node.js in a local folder to use Babel, not sure if this has anything to do with it?
Many thanks!
sudo npm install -g #angular/cli
i have the same problem I give way perhaps work with you
This is how to solve it. Run this command:
sudo chown -R $USER /usr/local/lib/node_modules
sudo means we are running this command as root, the system super user. This is because we don’t have permission to write to that folder, but root will be able to fix any permission. This command also means the system will ask for your password to confirm.
chown is the command we use to change the owner of a file or folder. We set the -R option to change the owner recursively, so we also get owner access to all the files already contained in there.
$USER is an environment variable automatically set to your username.
And the final piece is the folder path.
Running this path will make the folder yours, so you can safely run your npm install -g commands!
i go with the previous answer i put it and i install angular well,
but i appear for me another maybe also related with
npm audit
for resolve, it follows this question link answer
how to fix the npm audit report
i hope is a benefit for you

Unable to install angular cli with npm errno -4048 package.json

I tried installing angular cli with npm. But I'm getting the below error while executing the command npm install -g #angular/cli.
I am not executing this command as admin, but as a user.
D:\AngularWorkstation>npm install -g #angular/cli
npm WARN sass-loader#6.0.6 requires a peer of node-sass#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! path **D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json.365294863
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json.365294863' -> 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json'
npm ERR! { Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json.365294863' -> 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json'
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json.365294863' ->** 'D:\node_modules\node_modules\#angular\cli\node_modules\which\package.json'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json.365294863',
npm ERR! dest: 'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json' },
npm ERR! stack: 'Error: EPERM: operation not permitted, rename \'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json.365294863\' -> \'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json.365294863',
npm ERR! dest: 'D:\\node_modules\\node_modules\\#angular\\cli\\node_modules\\which\\package.json',
npm ERR! parent: '#angular/cli' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\techno\AppData\Roaming\npm-cache\_logs\2018-01-03T09_14_35_602Z-debug.log
*PS : I'm using Windows10 OS. I also tried changing the npm global path to'D:\node_modules' to check if it's due to permission issue. However the output is the same.
node --version : v7.7.2
npm --version : 4.1.2*
I had a similar issue when trying to install Yeoman with npm on Windows 10. The culprit turned out to be the McAfee AV software that was installed on my machine.
McAfee seemed to be scanning the changes that npm was trying to make to a json file and as part of the scanning routine, prevented the rename from occurring. This resulted in a 4048 error being raised by npm similar to the error in your output.
To get around this I:
Uninstalled McAfee and restarted my machine so that it reverted to Microsoft's built-in security software.
Re-ran the npm install command and it worked correctly.
Alternatively, you could change the settings of your AV software to not actively check file changes for the node_modules folder. This would hopefully allow your AV software to stay installed and the npm command to work too.
From your error logs, It seems that there is some permission issue while installing the packages. You can specifically resolve this issue by two ways.
1) If you are trying to install the packages globally then you have to run the npm install <pkg_name> -g command with the administrative user or using sudo npm install <pkg_name> -g command.
To install the npm-packages globally you can follow the steps below:
Run the command prompt as the administrative user.
Run npm install <pkg_name> -g.
2) You should try going to the top-level folder in Windows Explorer, right-click on "get more info" option then go down to the permissions section, give yourself all permissions, and tell it to apply them recursively.
Or simply you can go to specified npm working directory and edit to permission section and allow all the permission to the current user and also change the owner to itself for all the recursive directories as well.
Then boot up Windows again.
Note: If you are installing an npm-package locally, then you should be in your local project directory and can try running sudo npm install <pkg-name> command to install required package. the purpose of using sudo is that it will change your owner permissions so you can make your current user authorized to run npm commands.
I'd recommend you to take a look at https://docs.npmjs.com/getting-started/fixing-npm-permissions
1) uninstall node
2) download latest version of node from [https://nodejs.org/en/][1] .
3) install node js

Error: EACCES: permission denied when running `npm install` on Elastic Beanstalk

I've provisioned a default clean node.js app via Elastic Beanstalk, and have a node.js script trying to run npm install inside the project directory (/var/app/current/deploy-dist), however, the following permission error is thrown:
npm WARN locking Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm WARN locking at Error (native)
npm WARN locking /tmp/.npm/_locks/staging-f212e8d64a01707f.lock failed { Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm WARN locking at Error (native)
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking syscall: 'open',
npm WARN locking path: '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock' }
npm WARN deploy-dist No description
npm WARN deploy-dist No repository field.
npm WARN deploy-dist No license field.
npm ERR! Linux 4.4.35-33.55.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path /tmp/.npm/_locks/staging-f212e8d64a01707f.lock
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, open '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/tmp/.npm/_locks/staging-f212e8d64a01707f.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/deploy-dist/npm-debug.log
The package.json is just a:
{
"dependencies": {
"node-fetch": "^1.3.3"
}
}
Running npm install with sudo obviously works, but is preferred to be avoided as a solution.
Setting NPM_CONFIG_PREFIX to a directory at ~ as per npm docs suggestion didn't work either, and the problem persists.
I suspect the problem lies in incorrect permissions for /tmp/.npm, which are
drwxr-xr-x 114 root root 4.0K Dec 27 17:04 .npm
This is confusing, as I expected a simple npm install to work out of the box.
UPDATE: Should not that the project directory already contains a node_modules folder, but even removing it and running npm install doesn't fix it.
I had this problem! You can use ebextensions to create a post-deploy script that changes the permissions of the tmp/npm/.locks folder.
In your node.js project, create a .ebextensions folder if you haven't got one already. Then, add a new config file, e.g. 00_create_postdeploy_script.config, with the following yaml:
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_fix_node_permissions.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm/_locks/
When you deploy, this will create a script in /opt/elasticbeanstalk/hooks/appdeploy/post called 99_fix_node_permissions.sh, which looks like this:
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm/_locks/
Because it's in that post folder, it will be run automatically after your app has deployed -- and hence change the permissions as required.
EDIT: If you're having trouble with the permissions of the whole .npm folder, then you should change the last line of the config file to:
chown -R nodejs:nodejs /tmp/.npm/
I have had this problem in past and in my case cleaning the cache fixed my issue.
Please try this
npm cache clean
Hope it helps.
The following command will fix the issue. it worked for me.
sudo chown -R 1000:1000 "/home/user/.npm"

NPM won't install pug?

Can anyone help me decipher what this message is about?
I have another app with pug installed, yet now I cannot create a new module installation for some reason.
I'm installing pug local to the app into node_modules
I'm just trying to get work done, so if I have missed something simple, my stress level has not been helpful with keeping precise vision.
My system is for ongoing development so I don't muck around with upgrades, which historically has broken all kinds of other stuff.
My other app works fine.
# npm install --save pug#2.0.0-beta4 <= Because the working app uses this one
npm ERR! Linux 3.2.0-35-generic-pae
npm ERR! argv "/home/kingram/.nvm/v0.10.46/bin/node" "/home/kingram/.nvm/v0.10.46/bin/npm" "install" "--save" "pug#2.0.0-beta4"
npm ERR! node v0.10.46
npm ERR! npm v2.15.1
npm ERR! path /home/kingram/.npm/wordwrap/0.0.2
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! Error: EACCES, mkdir '/home/kingram/.npm/wordwrap/0.0.2'
npm ERR! { [Error: EACCES, mkdir '/home/kingram/.npm/wordwrap/0.0.2']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/kingram/.npm/wordwrap/0.0.2',
npm ERR! parent: 'cliui' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/kingram/node/fssreg/npm-debug.log
You may need to install using sudo, ie - sudo npm install .... This will prompt you for your root password.
It looks like root privileges are required to install the package you're looking for. Though this shouldn't really be the case, you can fix this....check out this link
After some prodding by #zillaofthegods, it turns out some of directories in ~/.npm were owned by root. In particular the wordwrap module directory.
Changed the permissions and npm installed it fine.
One of those things I would not have caught without some prodding, so thanks.

Resources