'error An unexpected error occurred: "EPERM: operation not permitted, unlink 'path_to_project\\node_modules\\prisma\\query_engine-windows.dll.node'

I installed Prisma and I run npx primsa db push it pushed all tables to database successfully, after that I run npx prisma generate it tried to install @prisma/client and it fails with this error message:

error An unexpected error occurred: "EPERM: operation not permitted, unlink 'path_to_project\node_modules\prisma\query_engine-windows.dll.node'

I tried to remove node_modules and re-install all modules but it not worked.



Solution 1:[1]

I had this same error type with a different package. In my case the thing that was causing the error was because it couldn't access the folder while the app was still running ie. from this issue https://github.com/yarnpkg/yarn/issues/2685

This was following npm cache clean --force not resolving it.

Solution 2:[2]

I had the same error but after installing Microsoft Visual C++ 2015 Redistributable it works fine now

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman
Solution 2 john