prisma: "Error: Get config Error: Command failed with exit code 13 (EACCES): /.../node_modules/prisma2/query-engine-darwin cli [...]"

When running prisma init foo + Blank Project | SQLite | Confirm | JavaScript | Demo Script on CI (Azure Pipelines, Linux Linux fv-az679 4.15.0-1059-azure #64-Ubuntu SMP Fri Sep 13 17:02:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux and macOS Darwin Mac-612.local 17.7.0 Darwin Kernel Version 17.7.0: Sun Jun 2 20:31:42 PDT 2019; root:xnu-4570.71.46~1/RELEASE_X86_64 x86_64) it unfortunately crashes with Error: Get config Error: Command failed with exit code 13 (EACCES): /Users/vsts/foo/node_modules/prisma2/query-engine-darwin cli [...]:

2019-10-06T01:30:10.7505770Z bash-3.2$ prisma2 init foo
2019-10-06T01:30:25.9102030Z [?25l
2019-10-06T01:30:25.9104500Z Preparing your demo script (JavaScript) ...
2019-10-06T01:30:25.9104970Z 
2019-10-06T01:30:25.9106310Z ✔  Downloading the demo script from GitHub ...
2019-10-06T01:30:25.9107260Z ✔  Extracting content to foo ...
2019-10-06T01:30:25.9108120Z â ¸  Installing dependencies with: `npm install` ...
2019-10-06T01:30:25.9108840Z 4  Preparing your database ...
2019-10-06T01:30:25.9109730Z  ERROR  Error during command execution
2019-10-06T01:30:25.9110240Z 
2019-10-06T01:30:25.9111610Z Error: Get config Error: Command failed with exit code 13 (EACCES): /Users/vsts/foo/node_modules/prisma2/query-engine-darwin cli --get_config {"datamodel":"generator photon {\n  provider = \"photonjs\"\n}\n\ndatasource db {\n  provider = \"sqlite\"\n  url      = \"file:dev.db\"\n}\n\nmodel User {\n  id    String  @default(cuid()) @id\n  email String  @unique\n  name  String?\n  posts Post[]\n}\n\nmodel Post {\n  id        String   @default(cuid()) @id\n  createdAt DateTime @default(now())\n  updatedAt DateTime @updatedAt\n  published Boolean  @default(true)\n  title     String\n  content   String?\n  author    User?\n}"}
2019-10-06T01:30:25.9112150Z 
2019-10-06T01:30:25.9112980Z spawn /Users/vsts/foo/node_modules/prisma2/query-engine-darwin EACCES
2019-10-06T01:30:25.9113370Z error Command failed with exit code 1.

image


I think this could be related to the file not being executable, these are the file permissions in that folder:

# macOS

ls -l /Users/vsts/foo/node_modules/prisma2/
-rw-r--r--   1 vsts  staff   759 Oct  6 01:50 README.md
drwxr-xr-x  19 vsts  staff   646 Oct  6 01:50 build
drwxr-xr-x   3 vsts  staff   102 Oct  6 01:50 download-build
-rw-r--r--   1 vsts  staff   103 Oct  6 01:50 migration-engine
drwxr-xr-x   8 vsts  staff   272 Oct  6 01:50 nexus_prisma_ncc_build
-rw-r--r--   1 vsts  staff  2447 Oct  6 01:50 package.json
-rw-r--r--   1 vsts  staff    99 Oct  6 01:50 query-engine-darwin
drwxr-xr-x  16 vsts  staff   544 Oct  6 01:50 runtime

# Linux

ls -l   /home/vsts/foo/node_modules/prisma2/
drwxr-xr-x 15 vsts docker 4096 Oct  6 01:57 build
drwxr-xr-x  2 vsts docker 4096 Oct  6 01:57 download-build
-rw-r--r--  1 vsts docker  103 Oct  6 01:57 migration-engine
drwxr-xr-x  5 vsts docker 4096 Oct  6 01:57 nexus_prisma_ncc_build
-rw-r--r--  1 vsts docker 2447 Oct  6 01:57 package.json
-rw-r--r--  1 vsts docker   99 Oct  6 01:57 query-engine-linux-glibc-libssl1.1.0
-rw-r--r--  1 vsts docker  759 Oct  6 01:57 README.md
drwxr-xr-x  3 vsts docker 4096 Oct  6 01:57 runtime

If I read that correctly, the downloaded engines are not executable but should be?


I guess the problem is triggered while "postinstall": "prisma2 generate" is running, but might be caused earlier during installation.

As prisma2 init doesn’t show the npm install output, I don’t know exactly what the last output there was. Can I somehow get more information there to understand where the permissions go wrong?

PS: On Windows it works just fine 😄

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

@divyenduz I still had this issue in preview20, but spend some time to find what is going on: prisma2 generates fails was due to an absence of the engine binaries.

The problem was during installation: npm my cache folder was not writable (wrong permissions) and the download-build/index.js process fails silently whereas the cli indicates 100% downloaded and the flag file download-done created.

Maybe add an explicit message/error here will help. There is already a flag failSilent, but the value is true, why?

Wow, good catch @BjoernRave. Can you open a new issue about this please? Then we will formally reproduce this and then decide on what we can do about it. We should probably at least print a warning with instructions on how to do it manually or via a command of the CLI.

Using prisma2@2.0.0-preview-13.2 I can run prisma2 generate succesfully from my terminal, but it fails like above when being run as a postinstall script.

In my package.json I also have:

"config": {
    "unsafe-perm": true
  }

Doesn’t seem to make a difference though.

Note! My prisma2 is install globally with sudo

Can you please try using --unsafe-perm when installing prisma2 on that instance?

npm install -g --unsafe-perm prisma2