npm install failed with Error: EPERM: operation not permitted, unlink '\node_modules' - node.js

I try to run "npm install" command in CMD ["node_modules" is inside C drive] but installation failing with below error.
OS :Windows 10.
Node JS version: 6.9.0.
Error: EPERM: operation not permitted, unlink.
Goal: To run AngularJs project.
CMD command
npm install -- no optional;
PS C:\Users\arunk\Work\Workspaces\workspace-2\brainbox-frontend-angular> npm install --no-optional
npm ERR! path C:\Users\arunk\Work\Workspaces\workspace-2\brainbox-frontend-angular\node_modules\.staging\typescript-5afdc8eb\lib\tsc.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\arunk\Work\Workspaces\workspace-2\brainbox-frontend-angular\node_modules\.staging\typescript-5afdc8eb\lib\tsc.js'
npm ERR! [Error: EPERM: operation not permitted, unlink 'C:\Users\arunk\Work\Workspaces\workspace-2\brainbox-frontend-angular\node_modules\.staging\typescript-5afdc8eb\lib\tsc.js']
{
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink ' +
npm ERR! "'C:\\Users\\arunk\\Work\\Workspaces\\workspace-2\\brainbox-frontend-angular\\node_modules\\.staging\\typescript-5afdc8eb\\lib\\tsc.js'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\arunk\\Work\\Workspaces\\workspace-2\\brainbox-frontend-angular\\node_modules\\.staging\\typescript-5afdc8eb\\lib\\tsc.js'
npm ERR! }
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:
npm ERR! C:\Users\arunk\AppData\Roaming\npm-cache\_logs\2019-05-22T19_01_22_659Z-debug.log

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'

Like you I have wasted much time trying to get 'npm install' to install Angular projects from its 'project.json' file and received similar error messages that are unhelpful; Recently I installed 'yarn' and this does a much better job of populating the 'node_modules' folder and it also generates more useful error and warning messages in the process.
Try the following steps:
Install 'Yarn' - go to it's website and download the installer for your operating system.
Got to your project directory (the one containing 'project.json')
enter the command 'yarn' and wait. This will perform the same function
as 'npm install', however it will generate fewer messages but the ones
it does will be more pertinent.
I hope this helps.

I was using yarn to install axios and got the same error, but I figured out that this error is not peculiar to axios since the same thing happens with all other packages.
Killing all running node process worked for me.

Perhaps a problem with the file system.
Check your C drive with the windows verification tool (right click on the C: -> Properties -> Tools -> Check). Repair the errors if it's needed.
It worked for me. I write here this solution for people (like me) with similar issue.

Similar problem can also happen if you try to uninstall a dependency while in another terminal window you're using
ng serve
Simply stop that operation and only then you can uninstall it.

Please try following steps:
check your antivirus status is enable or disable
disable your antivirus during the installation.
I hope this helps. It worked for me.

Related

Error: "The operation was rejected by your operating system" when trying to create new angular project using windows powershell

I keep getting the same error message when trying to create a new angular project.
I tried to create a new angular project using Windows Powershell with the following commands:
ng new hello-world
-> Would you like to add angular routing? - Yes
-> Stylesheet format? - CSS
I obtained the error message below. I already tried to reinstall angular cli and I'm running Powershell using Administrator.
Installed versions:
Angular CLI: 8.0.6
Node: 10.16.0
OS: win32 x64
Error message:
npm WARN tarball data for tslint#~5.15.0 (sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for jasmine-spec-reporter#~4.2.1 (sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for acorn#^6.0.5 (sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for #angular/language-service#~8.0.3 (sha512-04XojOo9FJgEQE/rZafnaJQxPEU+//TSzTgpGoIVzCSMx+joCY/ZSSwJZPWxiHlOE57W/zX02ZY+TwcM81oTdw==) seems to be corrupted. Trying one more time.
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\#angular\platform-browser-447d0944\esm2015\animations\src\animation_builder.js'
npm ERR! path C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\jasmine-spec-reporter-cbb15ffc\screenshot.gif'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'C:\\Users\\konta\\Desktop\\Programming_files\\Angular\\hello-world\\node_modules\\.staging\\jasmine-spec-reporter-cbb15ffc\\screenshot.gif',
npm ERR! parent: 'hello-world' }
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 WARN tar EPERM: operation not permitted, lstat 'C:\Users\konta\Desktop\Programming_files\Angular\hello-world\node_modules\.staging\#angular\router-8388bfd5\esm2015\src\directives'
npm WARN tarball tarball data for typescript#3.4.4 (sha512-xt5RsIRCEaf6+j9AyOBgvVuAec0i92rgCaS3S+UVf5Z/vF2Hvtsw08wtUTJqp4djwznoAgjSxeCcU4r+CcDBJA==) seems to be corrupted. Trying one more time.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\konta\AppData\Roaming\npm-cache\_logs\2019-07-01T01_21_13_653Z-debug.log
Package install failed, see above.
I found the problem: My antivirus was somehow blocking the files without me knowing. It worked once I paused my antivirus during the installation.
In windows10 I disabled the windows defender / windows security ==> realtime protection and try again npm install command and it worked
1.
2.
3.
NOTE : Turn on the real time protection again after installation complete.
Restarting the machine worked for me.
I had this problem on MAC. I just added 'sudo' before the command and it worked.
sudo npm install -g parcel-bundler
I tried opening CMD with Run as Admisnistrator then run npm i and it worked for me
I'd just like to add a small little answer based on Qadir Hussain's answer.
If you disable "Realtime Protection" in Windows Security, you're going to leave your laptop or PC vulnerable to any viruses that may infect it when "Realtime Protection" is off. This may seem a bit impossible if you're only installing an NPM package, but some apps may have a hidden background process waiting for "Realtime Protection" to be disabled, and when it is, it could inject a virus.
That been said, there's still an option.
First things first, open Windows Security by typing "Windows Security" in the Start Menu and tap "Open".
After that, go to "Virus & Threat Protection".
Next, scroll down until you find "Manage Settings" under "Virus & Threat Protection Settings".
Then, scroll down until you see "Exclusions". Under "Exclusions" there's a link that says "Add or remove exclusions".
Once that's done, tap the button that says "Add an exclusion". Then tap "Folder" on the drop-down menu.
Choose the node_modules directory that is giving issues.
Last but not least, Allow administrative permissions.
Finally, exit Windows Security.
I wouldn't recommend excluding your entire Projects folder, as that will disable all scans for the directory.
Small disclaimer here, I'm only making this answer as a means of helping others without disabling "Realtime Protection". While I'm not encouraging this, this might help fix a common problem.
Have a good day. :)
For me, there are several possibilities:
Intercepted by anti-virus software, resulting in inoperability.
It is locked by IDE, resulting in inoperable.
The task is locked by npm running, resulting in inoperable.
Cancelling the npm start process and closing the terminal window (I use Hyper Terminal) worked for me (using Win 10).
I was then able to uninstall an npm package and install another.
I had visual studio code running. I turned it off and boom! worked for me!
To me, using Windows 10 the only thing that solved this problem was: exclude the node_modules folder, open Visual Studio Code in Admin mode in the project folder, and execute the following command:
npm install -g --unsafe-perm
For me the issue was with npm version I was using. I changed to a npm version which did not have the bug by using the below command:
npm install --global npm#8.3.1
I found this solution in a github issue:
Link to github issue
Hope it helps you like it did me!
was facing this problem and this is how it got solved :
-stoping the execution of the development server for both front-end and backend:
two things:
try admin.
make sure other processes does not occupying the folder/file
with me, it was not related to antivirus.
it appears that a process occupied this folder. in my case a node process occupied my node_modules folder.
i found it out by using process-explorer - i searched the path end found that a node process using this folder(even though I closed it! very common in windows), so i ended this process and then i did not got this error anymore.
I had the same issue What I have done wrong is I had set the npm registry to a local registry, without knowing that I faced this issue once I reset to globally using npm config set registry https://registry.npmjs.org/ error went away.
I tried everything above.
Deleting node_modules and re-installing did the trick for me.
This happened when I tried installing a new npm dependency, jest, with:
npm i --save-dev jest
I got it working by simply rerunning the command.

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

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

Can't install any packages to NPM or BOWER

I have researched this extensively and nothing. So I am hoping this generates a different solution.
I keep getting this error
npm WARN packages#1.0.0 No description
npm WARN packages#1.0.0 No repository field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "express"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at destStatted (C:\Users\Luis\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' ->
'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at destStatted (C:\Users\Luis\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at Error (native) parent: 'packages' }
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! C:\xampp\htdocs\nodeprojects\contact-list-app\npm-debug.log
It's not a Mac, It's a Windows machine, so nothing to do with sudo as other responses suggested here
I don't have an antivirus running so this was a no-go too
I ran npm cache clean as suggested here and other SO solutions
It was running fine, and then it started doing this when I tried to install angular-ui-bootstrap. but I was able to install other dependencies just fine.
I also did:
Restarted my machine
used CMD as administrator
Used git bash
Used npm console
Deleted the whole thing and started again in another directory ( got desperate)
uninstalled and re-installed node.js
drank a lot of coffee, and upgraded to alcohol
Please bail me out.
I am posting this answer, simply because there isn't enough documentation on this error in the web, but please if you have other ideas you'd like to add as a possible solution (other than the ones I tried in my question) please feel free. I'm sure there are a lot of other frustrated developers looking for this. Anyway, this is how I solved it.
I deleted my node_modules folder just so I can re-install the dependencies fresh. This doesn't break anything in your project because as soon as you add them back up, they will be in the exact same place they were before. So, do n't be afraid of the 404s you will get temporarily.
Then I did a fresh install by running
npm init
This get my packages.json file going
And then I tried to install my first dependency, any dependency, pick one. But the error came up and the node_modules didn't even get started. So I got it running by installing npm in itself as a dependency. Why did this work? Beats me! But the mystic powers of node know something I don't and I am ok with that.
So I did this basically
npm install npm --save
This built my node_modules folder and I was able to install everything back. I removed the npm dependency afterwards and it's like it was never there.
Again, feel free to post any other solutions. I don't think this is a definite solution so I won't mark it. It just worked for me. Thought I shared it
EDIT
DO NOT delete that npm dependency by running npm uninstall <package> as you normally would. Instead, just delete the dependency with a good 'ol delete key

installing PhantomJS on Windows: rolling back Error: EPERM, unlink phantomjs.exe

I try to install karam/Jasmine/PhantomJS on my Windows machine.
It was installed before in a different project. I have my proxies set up nicely, but it throws a weird error.
npm ERR! error rolling back Error: EPERM, unlink 'C:\xampp\htdocs\acme\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe'
npm ERR! error rolling back karma-phantomjs-launcher#0.1.4 { [Error: EPERM, unlink 'C:\xampp\htdocs\acme\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe']
npm ERR! error rolling back errno: 50,
npm ERR! error rolling back code: 'EPERM',
npm ERR! error rolling back path: 'C:\\xampp\\htdocs\\acme\\node_modules\\karma-phantomjs-launcher\\node_modules\\phantomjs\\lib\\phantom\\phantomjs.exe' }
npm ERR! Error: EPERM, unlink 'C:\xampp\htdocs\acme\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe'
npm ERR! { [Error: EPERM, unlink 'C:\xampp\htdocs\acme\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\xampp\\htdocs\\acme\\node_modules\\karma-phantomjs-launcher\\node_modules\\phantomjs\\lib\\phantom\\phantomjs.exe' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
So I deleted the phantomjs.exe and tried again.
I executed the console as admin and retried.
I deleted the whole node_modules folder and installed again
I used npm cache clear
I deactivated my A/V as suggested here
... same error.
Why would npm try to delete the PhantomJS during install? As I said, I deleted it before. So I have no node_modules folder, execute npm install and it creates the phantomjs.exe and then fails with said error.
Any ideas anyone?
I had a similar issue that ultimately seemed to have been caused by still having an errant phantomjs.exe process running while I was performing an npm update.
While it seems unlikely that this may have been the same cause as what you were experiencing, it seems to be at the very least one of the ways to receive this same error message.
I was able to resolve by opening up Windows Task Manager (Ctrl+Shift+Esc), finding phantomjs.exe in the Processes tab, and using 'End Process' on it.

Resources