Repository: strapi/strapi

Issue #19478: New installation does not complete successfully with yarn
Created: 2024-02-11T19:12:47Z
Bug report
Required System information





Node.js version: 20.11.0 and 18.14.2
NPM version: 10.2.4 (with Node 20) and 9.8.1 (with Node 18)
Yarn version: 3.4.1
Strapi version: latest
Database: Postgres or sqlite (does not affect results if using Quickstart or custom with Postgres)
Operating system: macOS 13.3.1
Is your project Javascript or Typescript: TypeScript (but error occurred with either)


Describe the bug
Setup of a new project with 'yarn' does not seem to complete successfully. Setup can only be completed with npm.
I have tried this in multiple directories, all with new installations.
Steps to reproduce the behavior

Run yarn create strapi-app my-project or npx create-strapi-app@latest my-project - the resulting output is the same for both.

$ yarn create strapi-app my-project
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 4s 706ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done in 4s 818ms

? Choose your installation type Quickstart (recommended)
Creating a quickstart project.
Creating a new Strapi application at /Users/st0w/Desktop/testing/my-project.
Creating files.
Error while installing dependencies:

 Keep trying!

Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.
Fix the issues mentioned in the installation errors and try to run the following command:

cd /Users/st0w/Desktop/testing/my-project && yarn install



Following the on-screen instructions, cd my-project && yarn install (note that even if using npx to install, the on-screen instructions still prompt using yarn which probably shouldn't occur, since mixing yarn and npm is not a good idea).

cd my-project && yarn install
➤ YN0000: ┌ Resolution step
➤ YN0032: │ better-sqlite3@npm:8.6.0: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ @koa/router@npm:10.1.1 is deprecated: **IMPORTANT 10x+ PERFORMANCE UPGRADE**: Please upgrade to v12.0.1+ as we have fixed an issue with debuglog causing 10x slower router benchmark performance, see https://github.com/koajs/router/pull/173
➤ YN0061: │ formidable@npm:1.2.6 is deprecated: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
➤ YN0032: │ fsevents@npm:2.3.3: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ sharp@npm:0.32.6: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ node-addon-api@npm:6.1.0: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ mailcomposer@npm:3.12.0 is deprecated: This project is unmaintained
➤ YN0061: │ buildmail@npm:3.10.0 is deprecated: This project is unmaintained
➤ YN0061: │ source-map-resolve@npm:0.5.3 is deprecated: See https://github.com/lydell/source-map-resolve#deprecated
➤ YN0061: │ urix@npm:0.1.0 is deprecated: Please see https://github.com/lydell/urix#deprecated
➤ YN0061: │ resolve-url@npm:0.2.1 is deprecated: https://github.com/lydell/resolve-url#deprecated
➤ YN0061: │ source-map-url@npm:0.4.1 is deprecated: See https://github.com/lydell/source-map-url#deprecated
➤ YN0002: │ @strapi/admin@npm:4.20.0 [ae5f8] doesn't provide scheduler (p03657), requested by use-context-selector
➤ YN0002: │ @strapi/design-system@npm:1.14.1 [04b72] doesn't provide @codemirror/view (p1c683), requested by @uiw/react-codemirror
➤ YN0002: │ @strapi/design-system@npm:1.14.1 [b8ff5] doesn't provide @codemirror/view (p0d5c4), requested by @uiw/react-codemirror
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react (p2b629), requested by @strapi/admin
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react (p43808), requested by @strapi/content-releases
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react (pcbf06), requested by @strapi/plugin-content-type-builder
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react (p70453), requested by @strapi/plugin-email
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react (p64a62), requested by @strapi/plugin-upload
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-dom (p173e7), requested by @strapi/admin
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-dom (p5c6d8), requested by @strapi/content-releases
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-dom (p2e5df), requested by @strapi/plugin-content-type-builder
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-dom (pe3cbc), requested by @strapi/plugin-email
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-dom (p5cf2e), requested by @strapi/plugin-upload
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-router-dom (p2893a), requested by @strapi/admin
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-router-dom (pc97ca), requested by @strapi/content-releases
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-router-dom (pe9c6f), requested by @strapi/plugin-content-type-builder
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-router-dom (pdc7f5), requested by @strapi/plugin-email
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide react-router-dom (p49b71), requested by @strapi/plugin-upload
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide styled-components (p02b17), requested by @strapi/admin
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide styled-components (p621a5), requested by @strapi/content-releases
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide styled-components (pc1354), requested by @strapi/plugin-content-type-builder
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide styled-components (padefb), requested by @strapi/plugin-email
➤ YN0002: │ @strapi/strapi@npm:4.20.0 doesn't provide styled-components (p9e531), requested by @strapi/plugin-upload
➤ YN0002: │ babel-plugin-styled-components@npm:2.1.4 [ae2d7] doesn't provide @babel/core (p23b9d), requested by @babel/plugin-syntax-jsx
➤ YN0002: │ my-project@workspace:. doesn't provide react-is (pc2399), requested by styled-components
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 8s 25ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yargs@npm:16.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:17.7.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ ylru@npm:1.3.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yup@npm:0.32.9 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 6s 60ms
➤ YN0000: ┌ Link step
➤ YN0031: │ One or more node_modules have been detected and will be removed. This operation may take some time.
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ core-js-pure@npm:3.35.1 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.19.11 must be built because it never has been before or the last one failed
➤ YN0007: │ @swc/core@npm:1.4.0 [3fa68] must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.19.12 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.16.17 must be built because it never has been before or the last one failed
➤ YN0007: │ sharp@npm:0.32.6 must be built because it never has been before or the last one failed
➤ YN0007: │ better-sqlite3@npm:8.6.0 must be built because it never has been before or the last one failed
➤ YN0007: │ @strapi/strapi@npm:4.20.0 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 3s 520ms
➤ YN0000: Done with warnings in 17s 711ms

Note that at completion of this step, there is no node_modules directory in the root of the project, and the my-project directory totals 237MB.

Run yarn develop

yarn develop
(node:73206) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:73206) ExperimentalWarning: Use `importAttributes` instead of `importAssertions`
(Use `node --trace-warnings ...` to show where the warning was created)
[ NaN ]
⠋ Building build context
[INFO] Including the following ENV variables as part of the JS bundle:
    - ADMIN_PATH
    - STRAPI_ADMIN_BACKEND_URL
    - STRAPI_TELEMETRY_DISABLED
[ERROR]  There seems to be an unexpected error, try again with --debug for more information

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                                                                                                                                             │
│   TypeError: Cannot convert undefined or null to object                                                                                                                                                                     │
│   at Function.keys (<anonymous>)                                                                                                                                                                                            │
│   at matchFromAbsolutePaths                                                                                                                                                                                                 │
│   (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/esbuild-register-virtual-87a21e6ca6/0/cache/esbuild-register-npm-3.5.0-d823f64ce0-f4307753c9.zip/node_modules/esbuild-register/dist/node.js:2821:27)            │
│   at /Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/esbuild-register-virtual-87a21e6ca6/0/cache/esbuild-register-npm-3.5.0-d823f64ce0-f4307753c9.zip/node_modules/esbuild-register/dist/node.js:2809:14           │
│   at Module._resolveFilename                                                                                                                                                                                                │
│   (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/esbuild-register-virtual-87a21e6ca6/0/cache/esbuild-register-npm-3.5.0-d823f64ce0-f4307753c9.zip/node_modules/esbuild-register/dist/node.js:4793:21)            │
│   at require (node:internal/modules/esm/translators:242:30)                                                                                                                                                                 │
│   at loadFile                                                                                                                                                                                                               │
│   (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/0/cache/@strapi-admin-npm-4.20.0-c3812a07ef-0e14fb5640.zip/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:413:17)   │
│   at async loadUserPluginsFile                                                                                                                                                                                              │
│   (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/0/cache/@strapi-admin-npm-4.20.0-c3812a07ef-0e14fb5640.zip/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:519:24)   │
│   at async getEnabledPlugins                                                                                                                                                                                                │
│   (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/0/cache/@strapi-admin-npm-4.20.0-c3812a07ef-0e14fb5640.zip/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:495:27)   │
│   at async createBuildContext                                                                                                                                                                                               │
│   (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/0/cache/@strapi-admin-npm-4.20.0-c3812a07ef-0e14fb5640.zip/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:612:19)   │
│   at async Object.develop                                                                                                                                                                                                   │
│   (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/0/cache/@strapi-admin-npm-4.20.0-c3812a07ef-0e14fb5640.zip/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:750:19)   │
│                                                                                                                                                                                                                             │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

The only way I could get Strapi to install and run successfully was to ignore the on-screen instructions to run yarn install and instead use npx and npm. Running the initial npx create-strapi-app@latest my-project still gave the error about unsuccessful install, but instead of running yarn install I ran npm install. This time, at the end, not only did I have a node_modules directory, but the size of the my-project directory was 533MB. It seems like running the install with yarn is not doing everything it needs to, even though no errors are reported.
Steps to complete successfully:

npx create-strapi-app@latest my-project
cd my-project && npm install
npm run develop

Expected behavior
On a clean install following the instructions from https://docs.strapi.io/dev-docs/installation/cli, using the Quickstart, I would expect installation to proceed without error.
Note that if I start with node 18 or 20, the results are the same.
Additional context

I also tried using Yarn 4, which resulted in the same initial failed setup as in step 1 above. Upon running yarn install in the my-project directory, it seemed to run just fine - although again, no node_modules directory, and this time the directory size was only 125MB. When running yarn develop the error was different:

$ yarn develop
⠋ Building build context
[INFO] Including the following ENV variables as part of the JS bundle:
    - ADMIN_PATH
    - STRAPI_ADMIN_BACKEND_URL
    - STRAPI_TELEMETRY_DISABLED
✔ Building build context (73ms)
⠙ Creating admin/Users/st0w/Desktop/testing/my-project/.pnp.cjs:22932
      Error.captureStackTrace(firstError);
            ^

Error: @strapi/admin tried to access redux, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: redux
Required by: @strapi/admin@virtual:ae5f8c797205abfa3dcfafae9cfefaef844c8117380d30d437be18515685ac72aeea09106623f0fabb5510aec32a318adc79297732c6d1fdf89a5f1e49d9a73a#npm:4.20.0 (via /Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/dist/_chunks/)

Require stack:
- /Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/dist/_chunks/config-e-cmAy8N.js
- /Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/dist/_chunks/build-bnYNP-fZ.js
- /Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js
- /Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/dist/cli.js
- /Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/index.js
- /Users/st0w/Desktop/testing/my-project/.yarn/unplugged/@strapi-strapi-npm-4.20.0-ae5f8c7972/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/action.js
- /Users/st0w/Desktop/testing/my-project/.yarn/unplugged/@strapi-strapi-npm-4.20.0-ae5f8c7972/node_modules/@strapi/strapi/dist/commands/actions/watch-admin/command.js
- /Users/st0w/Desktop/testing/my-project/.yarn/unplugged/@strapi-strapi-npm-4.20.0-ae5f8c7972/node_modules/@strapi/strapi/dist/commands/index.js
- /Users/st0w/Desktop/testing/my-project/.yarn/unplugged/@strapi-strapi-npm-4.20.0-ae5f8c7972/node_modules/@strapi/strapi/dist/cli.js
- /Users/st0w/Desktop/testing/my-project/.yarn/unplugged/@strapi-strapi-npm-4.20.0-ae5f8c7972/node_modules/@strapi/strapi/bin/strapi.js
    at require$$0.Module._resolveFilename (/Users/st0w/Desktop/testing/my-project/.pnp.cjs:22932:13)
    at Function.resolve (node:internal/modules/helpers:187:19)
    at <anonymous> (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/_internal/node/webpack/aliases.ts:54:48)
    at Array.reduce (<anonymous>)
    at getAdminDependencyAliases (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/_internal/node/webpack/aliases.ts:46:6)
    at getAliases (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/_internal/node/webpack/aliases.ts:59:24)
    at resolveBaseConfig (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/_internal/node/webpack/config.ts:30:14)
    at Object.resolveProductionConfig (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/_internal/node/webpack/config.ts:160:22)
    at <anonymous> (/Users/st0w/Desktop/testing/my-project/.yarn/__virtual__/@strapi-admin-virtual-04b721b9d2/4/.yarn/berry/cache/@strapi-admin-npm-4.20.0-c3812a07ef-10c0.zip/node_modules/@strapi/admin/_internal/node/webpack/build.ts:10:20)

Node.js v20.11.0

Duplicate issue #19121: npx create-strapi-app error while installing dependencies 
Created: 2023-12-26T09:17:39Z
Bug report
Required System information





Node.js version: v20.5.1
NPM version: 9.8.0
Strapi version: 4.16.2
Database: none yet
Operating system: macOS ventura 13.6
Is your project Javascript or Typescript:  Javascript


Describe the bug
Just trying to get started with Strapi. Running this command in terminal: npx create-strapi-app@latest cms --quickstart and getting the below error message.
Need to install the following packages:
create-strapi-app@4.16.2
Ok to proceed? (y) y
Creating a quickstart project.

Creating files.
Error while installing dependencies:
npm WARN config production Use `--omit=dev` instead.
npm WARN config optional Use `--omit=optional` to exclude optional dependencies, or
npm WARN config `--include=optional` to include them.
npm WARN config
npm WARN config     Default value does install optional deps unless otherwise omitted.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated mailcomposer@3.12.0: This project is unmaintained
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated @koa/router@10.1.1: **IMPORTANT 10x+ PERFORMANCE UPGRADE**: Please upgrade to v12.0.1+ as we have fixed an issue with debuglog causing 10x slower router benchmark performance, see https://github.com/koajs/router/pull/173
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated buildmail@3.10.0: This project is unmaintained
npm ERR! code 1
npm ERR! path /Users/username/www/cms/node_modules/esbuild
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! /Users/username/www/cms/node_modules/esbuild/install.js:132
npm ERR!     throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`);
npm ERR!           ^
npm ERR!
npm ERR! Error: Expected "0.19.2" but got "0.18.20"
npm ERR!     at validateBinaryVersion (/Users/username/www/cms/node_modules/esbuild/install.js:132:11)
npm ERR!     at /Users/username/www/cms/node_modules/esbuild/install.js:285:5
npm ERR!
npm ERR! Node.js v20.8.0

npm ERR! A complete log of this run can be found in: /Users/username/.npm/_logs/2023-12-26T05_17_11_808Z-debug-0.log
TypeError: Cannot read properties of undefined (reading 'addBreadcrumb')
    at /Users/username/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/utils/usage.js:36:31
    at Array.forEach (<anonymous>)
    at Module.captureStderr (/Users/username/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/utils/usage.js:35:37)
    at createProject (/Users/username/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/create-project.js:133:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async createQuickStartProject (/Users/username/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/create-quickstart-project.js:18:3)
Steps to reproduce the behavior

Open `terminal'
Run this command 'npx create-strapi-app@latest cms --quickstart'
See error

Expected behavior
npm install should complete without errors.
Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
If applicable, add code samples to help explain your problem.
Additional context
Add any other context about the problem here.

Closing comment (2024-04-29T18:06:25Z): Same issue here - also a duplicate of #19478
Why are these just getting auto-closed?
Edit: Strangely, deleting node_modules and running npm install again seems to resolve the issue. At least in my case