verdaccio: Error: EPERM: operation not permitted, unlink on npm install
Describe the bug I’m getting the following error when running npm install:
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\projects\my-project\node_modules\.staging\typescript-dbc2289d\lib\typescriptServices.js'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\projects\my-project\node_modules\.staging\typescript-dbc2289d\lib\typescriptServices.js']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\projects\my-project\node_modules\.staging\typescript-dbc2289d\lib\typescriptServices.js'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\projects\\my-project\\node_modules\\.staging\\typescript-dbc2289d\\lib\\typescriptServices.js' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'C:\\projects\\my-project\\node_modules\\.staging\\typescript-dbc2289d\\lib\\typescriptServices.js\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\projects\\my-project\\node_modules\\.staging\\typescript-dbc2289d\\lib\\typescriptServices.js',
npm ERR! parent: 'my-project' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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:
My .npmrc:
cafile=C:\Users\xxx\ca.pem
@xxx:registry=https://my-domain:4873/
@yyy:registry=https://my-domain:4873/
package-lock=false
//my-domain:4873/:_authToken="some-token-string"
I’m running Verdaccio 3.11.6 through official Docker image using below configuration file:
Sometimes “npm login” solves it for a moment (as described in other similar issues) but later on it comes back. Tried all other possibilities found here on on stackoverflow.
To Reproduce Steps to reproduce the behavior:
- Set everything as described above.
- Run npm install.
- See error
Expected behavior Packages installed correctly.
Docker (please complete the following information):
- Docker verdaccio tag: latest
- Docker Version 17.05.0-ce
Configuration File (cat ~/.config/verdaccio/config.yaml)
http_proxy: http://xxx:yyy@my-domain:8080/
https_proxy: http://xxx:yyy@my-domain:8080/
no_proxy: localhost,127.0.0.1,my-domain
https:
key: /verdaccio/conf/my-domain.key
cert: /verdaccio/conf/my-domain.crt
ca: /verdaccio/conf/my-domain.csr
auth:
htpasswd:
file: /verdaccio/conf/htpasswd
# Maximum amount of users allowed to register, defaults to "+infinity".
# You can set this to -1 to disable registration.
# max_users: -1
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
cache: false
packages:
'@xxx/*':
# scoped packages
access: $all
publish: $authenticated
'@*/*':
# scoped packages
access: $all
publish: $authenticated
proxy: npmjs
'**':
# allow all users (including non-authenticated users) to read and
# publish all packages
#
# you can specify usernames/groupnames (depending on your auth plugin)
# and three keywords: "$all", "$anonymous", "$authenticated"
access: $all
# allow all known users to publish packages
# (anyone can register by default, remember?)
# publish: $authenticated
# if package is not available locally, proxy requests to 'npmjs' registry
proxy: npmjs
# log settings
logs:
- {type: stdout, format: pretty, level: http}
- {type: file, path: verdaccio.log, level: info}
middlewares:
audit:
enabled: true
max_body_size: 200mb
Debugging output - How to use it with docker?
$ NODE_DEBUG=request verdacciodisplay request calls (verdaccio <–> uplinks)$ DEBUG=express:* verdaccioenable extreme verdaccio debug mode (verdaccio api)$ npm -dddprints:$ npm config get registryprints:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (4 by maintainers)
Sometimes opened
IDEorEditoris the problem of failing installation, if you have openedVSCodewhile installing vianpmthen try closing theVSCodeor any otherIDEand try to run the npm command again, it worked in my case.restarting my computer solved it, i think an npm process is still runing and blocking access to node_modules folder.
In my case it was been blocked by my computer’s firewall, so I turned it off and it solved my problem.
I had the same problem and tried a lot of different things. This solved my problem:
1 - Uninstall NodeJs 2 - Delete folders ‘npm’ and ‘npm-cache’ from AppData/Roaming 3 - Deactivate firewall and all antivirus (including Windows Defender) 4 - Reboot the system 5 - Open command prompt as administrator and execute ‘npm install’
@DanielRuf It may take me some time to prepare proper test case but I will try my best (overloaded with work). I think the hardest thing will be to describe the configuration for development machines. It’s enterprise setup, centrally managed so I don’t know all the details. Can do a lot but there are some limitations. What I will try to provide at least is a couple more details in addition to what is in original description. Which logfile you have in mind?
fyi: did a quick check using yarn and installation went fine. Need to make couple more tests to make sure how the tool affects the flow.