I have a powershell build script that runs npm install at some point.
I looked into the issue around the net, but I couldn't find anything helpful. I saw that somebody recommended putting an exception in Windows Defender for the jenkins folder because it was locking files. I did that, still no luck.
I don't think there are any locks on my part from the script, I'm just running npm install.
The strange thing is that this doesn't always happen, sometimes it works, sometimes it doesn't.
26610 verbose stack Error: EPERM: operation not permitted, unlink 'C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js'
26612 verbose Windows_NT 10.0.18363
26613 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
26614 verbose node v12.18.2
26615 verbose npm v6.14.5
26616 error code EPERM
26617 error syscall unlink
26618 error path C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js
26619 error errno -4048
26620 error Error: EPERM: operation not permitted, unlink 'C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js'
26620 error [OperationalError: EPERM: operation not permitted, unlink 'C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js'] {
26620 error cause: [Error: EPERM: operation not permitted, unlink 'C:\Jenkins\workspace\...\node_modules\.staging\highcharts-705cfa89\highcharts.src.js'] {
26620 error errno: -4048,
26620 error code: 'EPERM',
26620 error syscall: 'unlink',
26620 error path: 'C:\\Jenkins\\workspace\\...\\node_modules\\.staging\\highcharts-705cfa89\\highcharts.src.js'
26620 error },
26620 error errno: -4048,
26620 error code: 'EPERM',
26620 error syscall: 'unlink',
26620 error path: 'C:\\Jenkins\\workspace\\...\\node_modules\\.staging\\highcharts-705cfa89\\highcharts.src.js',
26620 error parent: 'react'
26620 error }
26621 error The operation was rejected by your operating system.
26621 error It's possible that the file was already in use (by a text editor or antivirus),
26621 error or that you lack permissions to access it.
26621 error
26621 error If you believe this might be a permissions issue, please double-check the
26621 error permissions of the file and its containing directories, or try running
26621 error the command again as root/Administrator.
26622 verbose exit [ -4048, true ]
Try yarn install instead of npm install
For anyone who runs into this issue
The package-lock.json was the issue. We have a proget feed for npm packages that we use, but the package-lock.json had the registry set to the default npm registry. This is what caused the issues.
The solution is either to delete the package-lock.json file or to commit it after you run npm install with the correct registry.
Related
Is Angular a serious framework anymore if an error or bug seems so rampant and can persist for so long without any documented way of resolving it?
....
24695 silly saveTree | +-- builtin-modules#1.1.1
24695 silly saveTree | +-- semver#5.7.1
24695 silly saveTree | `-- tsutils#2.29.0
24695 silly saveTree +-- typescript#3.5.3
24695 silly saveTree `-- zone.js#0.9.1
24696 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\karma\node_modules\fsevents):
24697 warn enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\wamp64\www\SALES-IMS\node_modules\.staging\fsevents-25de8bdf\node_modules\abbrev' -> 'D:\wamp64\www\SALES-IMS\node_modules\.staging\abbrev-5ccfe549'
24698 verbose enoent SKIPPING OPTIONAL DEPENDENCY: This is related to npm not being able to find a file.
24698 verbose enoent SKIPPING OPTIONAL DEPENDENCY:
24699 verbose stack Error: EPERM: operation not permitted, unlink 'D:\wamp64\www\SALES-IMS\node_modules\.staging\typescript-4e9060a8\lib\tsserver.js'
24700 verbose cwd D:\wamp64\www\SALES-IMS
24701 verbose Windows_NT 10.0.17134
24702 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
24703 verbose node v12.11.1
24704 verbose npm v6.11.3
24705 error code EPERM
24706 error syscall unlink
24707 error path D:\wamp64\www\SALES-IMS\node_modules\.staging\typescript-4e9060a8\lib\tsserver.js
24708 error errno -4048
24709 error Error: EPERM: operation not permitted, unlink 'D:\wamp64\www\SALES-IMS\node_modules\.staging\typescript-4e9060a8\lib\tsserver.js'
24709 error [OperationalError: EPERM: operation not permitted, unlink 'D:\wamp64\www\SALES-IMS\node_modules\.staging\typescript-4e9060a8\lib\tsserver.js'] {
24709 error cause: [Error: EPERM: operation not permitted, unlink 'D:\wamp64\www\SALES-IMS\node_modules\.staging\typescript-4e9060a8\lib\tsserver.js'] {
24709 error errno: -4048,
24709 error code: 'EPERM',
24709 error syscall: 'unlink',
24709 error path: 'D:\\wamp64\\www\\SALES-IMS\\node_modules\\.staging\\typescript-4e9060a8\\lib\\tsserver.js'
24709 error },
24709 error stack: "Error: EPERM: operation not permitted, unlink 'D:\\wamp64\\www\\SALES-IMS\\node_modules\\.staging\\typescript-4e9060a8\\lib\\tsserver.js'",
24709 error errno: -4048,
24709 error code: 'EPERM',
24709 error syscall: 'unlink',
24709 error path: 'D:\\wamp64\\www\\SALES-IMS\\node_modules\\.staging\\typescript-4e9060a8\\lib\\tsserver.js',
24709 error parent: 'SALES-IMS'
24709 error }
24710 error The operation was rejected by your operating system.
24710 error It's possible that the file was already in use (by a text editor or antivirus),
24710 error or that you lack permissions to access it.
24710 error
24710 error If you believe this might be a permissions issue, please double-check the
24710 error permissions of the file and its containing directories, or try running
24710 error the command again as root/Administrator.
24711 verbose exit [ -4048, true ]
I have tried the following to no avail.
I have disabled the antivirus and
severally repeated the install,
reboot my machine,
ensured VS Studio Code is closed...,
run npm cache clean, then npm cache clean --force, manually deleted both npm
cache and npm folders under the %APPDATA% path and then reinstalled
angular with npm install -g #angular/cli
all to the same EPERM error,... different files but same errno -4048.
I have enough GB's of free space on hard drive, there's also nothing peculiar about permissions. Am an admin in the Windows 10 laptop. Every CMD instruction am running as administrator. It has been weeks on end, tried all sorts of suggestions online... and no solution in sight.
Finally, is there a way out of this? Or do I just abandon Angular for being a unreliable unusable framework?
I have finally been able to figure out a solution. Which is, to install the failing packages, each at a time using npm install package --force.
For instance, in my case it was npm install -g #angular/core#~8.2.13 --force and npm install -g typescript#~3.5.3 --force.
After which I then repeat ng new project-name command as before. It now works successfully.
Nothing else that has been suggested worked, not in my case.
Much thanks!
This doesn't have anything to do with Angular itself, but with your NodeJS installation and npm. The first step would be to ensure there is no real permission issue.
I Was facing the same and similar errors running npm install for an existing Angular 7 project for several weeks now. Finally decided to switch from npm to yarn and everything worked fine since then. Switching to yarn as package manager did the trick for me after inconsistent and random errors with npm annoyed me for several weeks.
Maybe downgrading to an older npm version (~5.3.0) could also fix that issue.
I'm trying to run npm install on my project but its showing EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules.staging
I don't have root administrative access. I'am using as local user in my system and my system is windows 10
node v10.16.3
npm v6.11.3
Can any one please help me to resolve this issue. I'am requesting you guys please.
3235 error code EPERM
3236 error syscall mkdir
3237 error path C:\Program Files\nodejs\node_modules\.staging
3238 error errno -4048
3239 error Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'
3239 error { [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging']
3239 error cause:
3239 error { Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'
3239 error errno: -4048,
3239 error code: 'EPERM',
3239 error syscall: 'mkdir',
3239 error path: 'C:\\Program Files\\nodejs\\node_modules\\.staging' },
3239 error stack:
3239 error 'Error: EPERM: operation not permitted, mkdir \'C:\\Program Files\\nodejs\\node_modules\\.staging\'',
3239 error errno: -4048,
3239 error code: 'EPERM',
3239 error syscall: 'mkdir',
3239 error path: 'C:\\Program Files\\nodejs\\node_modules\\.staging',
3239 error parent: 'nodemon' }
3240 error The operation was rejected by your operating system.
3240 error It's possible that the file was already in use (by a text editor or antivirus),
3240 error or that you lack permissions to access it.
3240 error
3240 error If you believe this might be a permissions issue, please double-check the
3240 error permissions of the file and its containing directories, or try running
3240 error the command again as root/Administrator.
3241 verbose exit [ -4048, true ]
Try clearing the cache:
npm cache clean --force
Or
npm uninstall npm -g
npm install npm -g
Or
npm set prefix 'C:\Users\User\AppData\Roaming\npm'
The last one worked for me
run these commands:
npm uninstall -g create-react-app
npm install -g create-react-app
that's will upgrade your npx, then run
npx create-react-app my-app
Open your command line (CMD) as an admin.
Navigate to your project directory.
Install the package globally e.g nodemon or any other npm package.
This worked for me.
on windows 10 👍
From Start Menu : type "CMD" then "run as administrator"
then continue using "Node Commands"
Delete 'C:\Users\User\AppData\Roaming\npm' folder or just rename it (like to 'npm_') to be on safe side, and then run command:
npm install
this will create 'C:\Users\User\AppData\Roaming\npm' folder again.
This worked for me.
Run
npm cache clear
npm install npm -g
If you run the command npm cache clear get error, it means you don't have npm installed yet, just run the following command: npm install npm -g
Then close command prompt or visual studio code and run it again to take effect
Today we ran into the same problem. It turned out that there was a environment variable set:
NPM_CONFIG_PREFIX=C:\Program Files\Nodejs
Removing this environment variable fixed the problem fo us.
I solve this issue...
Firstly you change your drive
c drive change make new drive D and then run your command
D:\nodejs> vue create hello-world
this is what worked for me
4399 error Error: EPERM: operation not permitted, unlink
'C:\Users\deven\AppData\Roaming\npm\node_modules.staging\tmp-5fcc012e\README.md'
4399 error { Error: EPERM: operation not permitted, unlink
'C:\Users\deven\AppData\Roaming\npm\node_modules.staging\tmp-5fcc012e\README.md'
4399 error cause: 4399 error { Error: EPERM: operation not
permitted, unlink
'C:\Users\deven\AppData\Roaming\npm\node_modules.staging\tmp-5fcc012e\README.md'
4399 error errno: -4048, 4399 error code: 'EPERM', 4399
error syscall: 'unlink', 4399 error path:
'C:\Users\deven\AppData\Roaming\npm\node_modules\.staging\tmp-5fcc012e\README.md'
}, 4399 error stack: 'Error: EPERM: operation not permitted, unlink
\'C:\Users\deven\AppData\Roaming\npm\node_modules\.staging\tmp-5fcc012e\README.md\'',
4399 error errno: -4048, 4399 error code: 'EPERM', 4399 error
syscall: 'unlink', 4399 error path:
'C:\Users\deven\AppData\Roaming\npm\node_modules\.staging\tmp-5fcc012e\README.md',
4399 error parent: '#angular/cli' } 4400 error The operation was
rejected by your operating system. 4400 error It's possible that the
file was already in use (by a text editor or antivirus), 4400 error or
that you lack permissions to access it. 4400 error 4400 error If you
believe this might be a permissions issue, please double-check the
4400 error permissions of the file and its containing directories, or
try running 4400 error the command again as root/Administrator (though
this is not recommended). 4401 verbose exit [ -4048, true ]
Since you're using Windows, you have to launch the terminal as administrator and retry should work.
It seems like this is a problem with npm. Try deleting your node_modules folder and running npm install again. This should fix the problem.
It may be possible that your package.json is open in some editor. Close it and then run the npm command again.
Try to uninstall the CLI using:
npm uninstall -g #angular/cli
and reinstall using:
npm install -g #angular/cli
and also try to update npm to latest version
npm cache clean --force
npm install -g npm#latest
It solved for me when I made this: Right-click on -What ever program I use- and select Run as Administrator.
Personally I made it on PowerShell, but I assume that it works this way on any program
Launch your code editor (eg.. Visual Studio Code) as Administrator.
npm install -g #vue/cli.
vue create yourprojectname.
Please try following steps:
Delete node_modules
Do npm cache clean --force
Restart the PC
Try again npm install, now modules will install without any issues
(optional) - If you are behind VPN and not using any private registry , exit VPN and do npm install after restarting pc
I had opened the project in multiple terminals. Later after closing all the respective terminals and running 'npm i', things started to work well.
I am trying to install angular-cli using latest versions of npm(5.3.0) and node (v8.2.1) on Windows7 64 bit environment. npm and node are working as expected.
But when I try to install angular-cli using the command:
npm install -g #angular/cli
It is failing after copying all the required files to the appdata/Raoming/npm folder. Below is the error stack trace:
11902 verbose stack Error: EPERM: operation not permitted, rename 'C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json.1854123090' -> 'C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json'
11903 verbose cwd C:\Windows\system32
11904 verbose Windows_NT 6.1.7601
11905 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "#angular/cli"
11906 verbose node v8.2.1
11907 verbose npm v5.3.0
11908 error path C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json.1854123090
11909 error code EPERM
11910 error errno -4048
11911 error syscall rename
11912 error Error: EPERM: operation not permitted, rename 'C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json.1854123090' -> 'C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json'
11912 error { Error: EPERM: operation not permitted, rename 'C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json.1854123090' -> 'C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json'
11912 error cause:
11912 error { Error: EPERM: operation not permitted, rename 'C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json.1854123090' -> 'C:\Users\agamull\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\webpack-dev-server\node_modules\string-width\package.json'
11912 error errno: -4048,
11912 error code: 'EPERM',
11912 error syscall: 'rename',
11912 error path: 'C:\\Users\\agamull\\AppData\\Roaming\\npm\\node_modules\\#angular\\cli\\node_modules\\webpack-dev-server\\node_modules\\string-width\\package.json.1854123090',
11912 error dest: 'C:\\Users\\agamull\\AppData\\Roaming\\npm\\node_modules\\#angular\\cli\\node_modules\\webpack-dev-server\\node_modules\\string-width\\package.json' },
11912 error stack: 'Error: EPERM: operation not permitted, rename \'C:\\Users\\agamull\\AppData\\Roaming\\npm\\node_modules\\#angular\\cli\\node_modules\\webpack-dev-server\\node_modules\\string-width\\package.json.1854123090\' -> \'C:\\Users\\agamull\\AppData\\Roaming\\npm\\node_modules\\#angular\\cli\\node_modules\\webpack-dev-server\\node_modules\\string-width\\package.json\'',
11912 error errno: -4048,
11912 error code: 'EPERM',
11912 error syscall: 'rename',
11912 error path: 'C:\\Users\\agamull\\AppData\\Roaming\\npm\\node_modules\\#angular\\cli\\node_modules\\webpack-dev-server\\node_modules\\string-width\\package.json.1854123090',
11912 error dest: 'C:\\Users\\agamull\\AppData\\Roaming\\npm\\node_modules\\#angular\\cli\\node_modules\\webpack-dev-server\\node_modules\\string-width\\package.json',
11912 error parent: 'webpack-dev-server' }
11913 error Please try running this command again as root/Administrator.
11914 verbose exit [ -4048, true ]
Note: I was successful in installing this on my MAC OS. I tried uninstalling npm and node, reinstalled again and tried again, but did not work. I have administrator access on the machine that I am working on. Tried running the command prompt as Administrator as well.
You might need to use Node6 for 32-bit support.
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.