EPERM: operation not permitted, unlink '...node_modules\prisma\query_engine-windows.dll.node'
See original GitHub issueBug description
Following the Getting Started guide, when it gets to the point of running the “migrate dev” command, the script tries to install some packages through npm (don’t know which ones) and this causes the error in title.
How to reproduce
- Follow the Getting started prisma guide up to and included the “npx prisma migrate dev --name init” command.
- Get the following error:
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "testprisma", schema "public" at "localhost:5432"
PostgreSQL database testprisma created at localhost:5432
The following migration(s) have been created and applied from new schema changes:
migrations/
└─ 20210909080511_init/
└─ migration.sql
Your database is now in sync with your schema.
Running generate... (Use --skip-generate to skip the generators)
npm WARN hello-prisma@1.0.0 No description
npm WARN hello-prisma@1.0.0 No repository field.
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\mbelletti\Documents\Projects\hello-prisma\node_modules\prisma\query_engine-windows.dll.node
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\mbelletti\Documents\Projects\hello-prisma\node_modules\prisma\query_engine-windows.dll.node'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\mbelletti\Documents\Projects\hello-prisma\node_modules\prisma\query_engine-windows.dll.node'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\mbelletti\Documents\Projects\hello-prisma\node_modules\prisma\query_engine-windows.dll.node'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\mbelletti\\Documents\\Projects\\hello-prisma\\node_modules\\prisma\\query_engine-windows.dll.node'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\mbelletti\\Documents\\Projects\\hello-prisma\\node_modules\\prisma\\query_engine-windows.dll.node',
npm ERR! parent: 'hello-prisma'
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\mbelletti\AppData\Roaming\npm-cache\_logs\2021-09-09T08_05_23_557Z-debug.log
Error: Command failed with exit code 4294963248: npm install -D prisma@3.0.1
The batch file cannot be found.
The log file is the following: 2021-09-09T08_05_23_557Z-debug.log
After this, the node_modules.bin directory no longer has the prisma executable, and the node_modules/prisma folder only contains the file that npm wasn’t able to remove (query_engine-windows.dll.node).
Expected behavior
The script finishes correctly.
Prisma information
All the prisma configurations are the ones taken from the guide.
Environment & setup
- OS: Windows 10
- Database: PostgreSQL 13
- Node.js version: 14.17.1 (using nvm)
Prisma Version
Environment variables loaded from .env
prisma : 3.0.1
@prisma/client : Not found
Current platform : windows
Query Engine (Node-API) : libquery-engine 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine : migration-engine-cli 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary : prisma-fmt 2452cc6313d52b8b9a96999ac0e974d0aedf88db (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 2452cc6313d52b8b9a96999ac0e974d0aedf88db
Studio : 0.423.0
(I had to relaunch npm install to get prisma back)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:40 (18 by maintainers)
Top Results From Across the Web
Error: EPERM: operation not permitted, unlink 'D:\Sources ...
I was able to fix this by running the command prompt/bash as admin and closing VSCode! Seems like VSCode was locking some files....
Read more >npm ci failes with errno -4048 syscall unlink
npm ci task fails sometimes on the "azure pipelines" agent with agent specification "windows-2019". ... Error: EPERM: operation not permitted, unlink ...
Read more >How to fix npm ERR! Error: EPERM: operation not ... - YouTube
How to fix npm ERR! Error: EPERM : operation not permitted, rename Solucionar el error npm ERR! ... en windows usando Windows PowerShell ......
Read more >Installation fails after attempted upgrade from 2.6.14
Attempted to upgrade to 2.11.1 by running npm install -g expo-cli. ... 4209 verbose stack Error: EPERM: operation not permitted, unlink ...
Read more >Error: EPERM: operation not permitted, unlink - Reddit
Error: EPERM: operation not permitted, unlink ... Does anyone know why this happens with serverless-webpack and serverless-plugin-typescript ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can confirm, just had the same error. Tried installing
@prisma/client
manually, it seems to help. So here is a possible workaround until the problem is fixed.node_modules
npm install
npm install @prisma/client
npx prisma generate
/npm prisma migrate dev
Try to install prisma client with:
yarn add @prisma/client
later try again with:yarn prisma migrate dev