Cannot install Webpack with NPM - node.js

npm install --save-dev webpack gives me the following error:
$ npm install --save-dev webpack
> uglifyjs-webpack-plugin#0.4.6 postinstall C:\Users\Martin\Desktop\JS\React\Mi-config\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
npm ERR! path C:\Users\Martin\Desktop\JS\React\Mi-config\node_modules\fsevents\node_modules\ansi-regex\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Martin\Desktop\JS\React\Mi-config\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\Martin\Desktop\JS\React\Mi-config\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native)
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\Martin\\Desktop\\JS\\React\\Mi-config\\node_modules\\fsevents\\node_modules\\ansi-regex\
\package.json\'\n at Error (native)',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Martin\\Desktop\\JS\\React\\Mi-config\\node_modules\\fsevents\\node_modules\\ansi-regex\\package.json' }
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\Martin\AppData\Roaming\npm-cache\_logs\2017-09-11T13_53_27_111Z-debug.log
It doesn't get added to package.json either
Can anyone help me please? I've reinstalled latest stable node version but still doesn't work.

Consider trying npm install --no-optional webpack --save-dev.
At least with Node 8.4 + npm 5.4.0 this helped me work around this today.

Close IDE and then try. It works for me

Related

Node won't install on a fresh project

I want to install npm, after running npm install on a fresh Laravel project I get this errors:
npm WARN deprecated popper.js#1.16.1: You can find the new Popper v2 at #popperjs/core, this package is dedicated to the legacy v1
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\Andrei Bunea\Desktop\Laravel\Project\node_modules\.staging\errno-1258eed7\.travis.yml
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Andrei Bunea\Desktop\Laravel\Project\node_modules\.staging\errno-1258eed7\.travis.yml'
npm ERR! [Error: EPERM: operation not permitted, unlink 'C:\Users\Andrei Bunea\Desktop\Laravel\Project\node_modules\.staging\errno-1258eed7\.travis.yml'] {
npm ERR! stack: "Error: EPERM: operation not permitted, unlink 'C:\\Users\\Andrei Bunea\\Desktop\\Laravel\\Project\\node_modules\\.staging\\errno-1258eed7\\.travis.yml'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Andrei Bunea\\Desktop\\Laravel\\Project\\node_modules\\.staging\\errno-1258eed7\\.travis.yml'
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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Andrei Bunea\AppData\Roaming\npm-cache\_logs\2020-04-25T17_06_43_120Z-debug.log
My npm version is v12.14.0 and my node version is v12.14.0 .
Delete the node_modules folder and package-lock.json file, then run npm install again.
You should run npm command as a super user.
Try,
sudo npm install
If it doesn't make sense try to delete node_modules and try npm install again

Error on npm install gatsby-plugin-styled-components

I am trying to install these npm packages
npm install --save gatsby-plugin-styled-components styled-components babel-plugin-styled-components
I am using node version 10.11.0
However I get the following error, I have tried running it in power-shell in administrator mode made no difference
npm ERR! path C:\Users\Anders\sites\pro-gatsby\node_modules\#types\events\npm-shrinkwrap.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall open
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\#types\events\npm-shrinkwrap.json'
npm ERR! { [Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\#types\events\npm-shrinkwrap.json']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\#types\events\npm-shrinkwrap.json'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path:
npm ERR! 'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\#types\\events\\npm-shrinkwrap.json' },
npm ERR! isOperational: true,
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, open \'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\#types\\events\\npm-shrinkwrap.json\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path:
npm ERR! 'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\#types\\events\\npm-shrinkwrap.json',
npm ERR! parent: '#types/glob' }
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\Anders\AppData\Roaming\npm-cache\_logs\2018-10-20T22_44_07_361Z-debug.log
Remove node_modules
npm cache clean
Try to install again
Should help.

Error while creating new project in angular

I am trying to create new angular project using the command ng new my-app. And the installed versions are listed below
Angular CLI : 6.0
Node version : 10.5.0
Npm : 6.1.0
I am getting the following error message,
ERR! path D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'D:\\ng\\newapp\\node_modules\\.staging\\typescript-4c0ca0e6\\lib\\lib.dom.d.ts' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'D:\\ng\\newapp\\node_modules\\.staging\\typescript-4c0ca0e6\\lib\\lib.dom.d.ts\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'D:\\ng\\newapp\\node_modules\\.staging\\typescript-4c0ca0e6\\lib\\lib.dom.d.ts',
npm ERR! parent: '#angular-devkit/build-optimizer' }
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).
temporary fix, downgrade npm to 5.3
npm install npm#5.3 -g
Use administrator privileges. Error says you are not using admin CMD
Install packages after closing your code editor,
Are you using Node Cmd or any IDE(like VSCode) to create new project
try this command
npm i -g #angular/cli
ng new app-name
cd app-name.
ng serve

npm - Error: EPERM: operation not permitted, unlink [duplicate]

This question already has answers here:
Fail to install npm package "npm ERR! errno -4048"
(21 answers)
Closed 5 years ago.
Windows 10 1703
Node 6.11.2
npm 5.4.0
Everytime I try to install an npm package (ex: npm i gulp-notify), I receive the following error:
npm ERR! path
C:\Users\web-dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json
npm ERR! code EPERM npm ERR! errno -4048 npm ERR!
syscall unlink npm ERR! Error: EPERM: operation not permitted,
unlink 'C:\Users\web-
dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native) npm ERR! { Error: EPERM:
operation not permitted, unlink
'C:\Users\web-dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native) npm ERR! stack: 'Error:
EPERM: operation not permitted, unlink
\'C:\Users\web-dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json\'\n
at Error (native)', npm ERR! errno: -4048, npm ERR!
code: 'EPERM', npm ERR! syscall: 'unlink', npm ERR!
path:
'C:\Users\web-dev\Desktop\barber\node_modules\fsevents\node_modules\ansi-regex\package.json'
} npm ERR! npm ERR! Please try running this command again as
root/Administrator.
I ran cmd as administrator
I checked folder permissions
I cleared cache even though npm says it does it by itself
I changed npm prefix to C:\Users\User Name\AppData\Roaming\npm
Nothing helps.
Please advise.
Apparently I was trying to install packages locally instead of globally without the -g flag. Sorry about that. All is working now.

Can't install package with npm install, EPERM error

I got an error when I try to install any package with npm install.
Here is an example when I try to install chart.js
H:\testNG>npm install chart.js --save npm ERR! path
H:\testNG\node_modules\fsevents\node_modules\aws-sign2\package.json
npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall unlink npm
ERR! Error: EPERM: operation not permitted, unlink
'H:\testNG\node_modules\fsevents\node_modules\aws-sign2\package.json'
npm ERR! at Error (native) npm ERR! { Error: EPERM: operation not
permitted, unlink
'H:\testNG\node_modules\fsevents\node_modules\aws-sign2\package.json'
npm ERR! at Error (native) npm ERR! stack: 'Error: EPERM:
operation not permitted, unlink
\'H:\testNG\node_modules\fsevents\node_modules\aws-sign2\package.json\'\n
at Error (native)', npm ERR! errno: -4048, npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink', npm ERR! path:
'H:\testNG\node_modules\fsevents\node_modules\aws-sign2\package.json'
} 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\flaur\AppData\Roaming\npm-cache_logs\2017-09-04T16_16_04_331Z-debug.log
I will provide the log file if someone want to watch it
https://1drv.ms/u/s!AgNenwMMyZRWg4tRDcK4OeoiZKeVZw
i was occur same thing. now, i solved. that's so simply
npm 4.0 was not apply.. some node_modules packages.
so you re install npm3.0

Resources