usna11
usna11

Reputation: 107

Can't create a strapi app with npx (issues with the sharp module then the sqlite3 module)

I am trying to create a strapi app using:

npx create-strapi-app my_project --quickstart

At the end of the installation I got this error:

(node:23048) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\koa\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
[2021-08-14T08:03:48.649Z] debug ⛔️ Server wasn't able to start properly.
[2021-08-14T08:03:48.650Z] error Error: 
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp.node'
Require stack:
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\sharp\lib\constructor.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\sharp\lib\index.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi-plugin-upload\services\image-manipulation.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\load\load-files.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\core\load-apis.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\core\load-modules.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\Strapi.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\index.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\lib\commands\develop.js
- C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\strapi\bin\strapi.js

- Remove the "node_modules/sharp" directory then run
  "npm install --ignore-scripts=false --verbose sharp" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues

    at Object.<anonymous> (C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\sharp\lib\constructor.js:32:9)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (C:\Users\Owner\Desktop\coding training\Next.js\dj-events\backend\node_modules\sharp\lib\index.js:3:15)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

The fixes I tried:

Then, when I ran npm run develop, I got the following error:

Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
[2021-08-14T08:23:02.906Z] error The client `sqlite3` is not installed.
[2021-08-14T08:23:02.907Z] error You can install it with `$ npm install sqlite3 --save`.

I am not sure why it is giving me this error as I have sqlite3 installed automatically. Nonetheless, I have deleted it and reinstalled it, but still having the same error over and over again!

If anyone could help with this one, I would really appreciate it! Thank you!

Upvotes: 1

Views: 3009

Answers (1)

usna11
usna11

Reputation: 107

Turns out the problem was with my npm version. Strapi does not support the latest npm version (v7). To get it to work properly, just downgrade to (v6)(npm i -g [email protected]) and it should work fine!

-- Another possible fix: Run the Strapi app inside a Docker container to avoid all issues! Check the 'How to run a Strapi app with Docker' instructions on the Strapi website for full details.

Upvotes: 4

Related Questions