Reputation: 126
node: 16.20.0
npm: 10.8.3
angular-cli: 19.0.0
OS: win32 x64
While trying to do npm install on udemy code repository it hits with following error.
npm error path C:\Users\<username>\Documents\<project-name>\node_modules\esbuild
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm error [esbuild] Failed to find package "@esbuild/win32-x64" on the file system
npm error
npm error This can happen if you use the "--no-optional" flag. The "optionalDependencies"
npm error package.json feature is used by esbuild to install the correct binary executable
npm error for your current platform. This install script will now attempt to work around
npm error this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
npm error
npm error [esbuild] Trying to install package "@esbuild/win32-x64" using npm
npm error [esbuild] Failed to install package "@esbuild/win32-x64" using npm: EPERM: operation not permitted, rename 'C:\Users\<username>\Documents\<project-name>\node_modules\esbuild\lib\npm-install\node_modules\@esbuild\win32-x64\esbuild.exe' -> 'C:\Users\<username>\Documents\<project-name>\node_modules\esbuild\lib\[email protected]'
npm error [esbuild] Trying to download "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz"
npm error [esbuild] Failed to download "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz": EPERM: operation not permitted, open 'C:\Users\<username>\Documents\<project-name>\node_modules\esbuild\lib\[email protected]'
npm error C:\Users\<username>\Documents\<project-name>\node_modules\esbuild\install.js:274
npm error throw new Error(`Failed to install package "${pkg}"`);
npm error ^
npm error
npm error Error: Failed to install package "@esbuild/win32-x64"
npm error at checkAndPreparePackage (C:\Users\<username>\Documents\<project-name>\node_modules\esbuild\install.js:274:15)
npm error at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm error A complete log of this run can be found in: C:\Users\gnagpure\AppData\Local\npm-cache\_logs\2025-01-07T13_42_31_515Z-debug-0.log
Upvotes: 1
Views: 265
Reputation: 121
In my case, it was my organization's AppLocker that was causing esbuild to not run. I had to get them to whitelist it.
Upvotes: 0