Skip to content

EPERM: operation not permitted, unlink '...node_modules\prisma\query_engine-windows.dll.node' #9184

@RedGlow

Description

@RedGlow

Bug 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

  1. Follow the Getting started prisma guide up to and included the "npx prisma migrate dev --name init" command.
  2. 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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions