Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New project creation fails with type error #20232

Open
fabio-nettis opened this issue Apr 30, 2024 · 3 comments
Open

New project creation fails with type error #20232

fabio-nettis opened this issue Apr 30, 2024 · 3 comments
Assignees
Labels
issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product source: generators status: pending reproduction Waiting for free time to reproduce the issue, or more information

Comments

@fabio-nettis
Copy link

Bug report

Required System information

  • Node.js version: v20.12.2 (nvm)
  • NPM version: v10.5.0 (nvm)
  • Strapi version: v4.24.0
  • Database: SQLite
  • Operating system: MacOS
  • Is your project Javascript or Typescript: Typescript

Describe the bug

When trying to create a new project using npm create-strapi-app@latest my-api or yarn create strapi-app@latest my-api the project initialization fails after choosing the quickstart option. Following error is displayed for me:

TypeError: Cannot read properties of undefined (reading 'addBreadcrumb')
    at /Users/fabio_nettis/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/utils/usage.js:36:31
    at Array.forEach (<anonymous>)
    at Module.captureStderr (/Users/fabio_nettis/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/utils/usage.js:35:37)
    at createProject (/Users/fabio_nettis/.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/fabio_nettis/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/create-quickstart-project.js:18:3)

Steps to reproduce the behavior

  1. Run yarn create strapi-app@latest my-api
  2. Choose the quickstart option
  3. See error

Expected behavior

The project should be created without any error, or display a more consice description of what the problem is.

@aminajao
Copy link

aminajao commented May 4, 2024

Having the same issue creating a strapi project without the quickstart option, but with a different error

success Installed "[email protected]" with binaries:

const stripAnsi = require('strip-ansi');

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/bilal/.config/yarn/global/node_modules/strip-ansi/index.js from /Users/bilal/.config/yarn/global/node_modules/ora/index.js not supported.

@num13ru
Copy link

num13ru commented May 8, 2024

The same thing happens when creating a project

Creating a project with custom database options.
Creating a new Strapi application at /Users/user/GIT/hello-world-strapi.
Creating files.
Error while installing dependencies:
error An unexpected error occurred: "Invalid URL".
TypeError: Cannot read properties of undefined (reading 'addBreadcrumb')
    at /Users/user/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/utils/usage.js:36:31
    at Array.forEach (<anonymous>)
    at Module.captureStderr (/Users/user/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/utils/usage.js:35:37)
    at createProject (/Users/user/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/create-project.js:133:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

addBreadcrumb is just the Sentry handler from packages/generators/app/src/utils/usage.ts:

export function captureStderr(name: string, error: unknown) {
  if (isStderrError(error) && error.stderr.trim() !== '') {
    error.stderr
      .trim()
      .split('\n')
      .forEach((line) => {
        sentry.addBreadcrumb({
          category: 'stderr',
          message: line,
          level: Severity.Error,
        });
      });
  }

  return captureError(name);
}

My guess is that the error is happening inside the runInstall function

@creotip
Copy link

creotip commented May 9, 2024

i have the following error while creating new project according to the docs:

Creating a quickstart project.
Creating a new Strapi application at /Users/ruslanelishaev/Desktop/projects/jsonserve-new.
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 ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @strapi/strapi@undefined
npm ERR! node_modules/@strapi/strapi
npm ERR!   @strapi/strapi@"4.24.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @strapi/strapi@"^4.0.0" from @strapi/[email protected]
npm ERR! node_modules/@strapi/plugin-i18n
npm ERR!   @strapi/plugin-i18n@"4.24.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/ruslanelishaev/.npm/_logs/2024-05-09T09_14_18_011Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/ruslanelishaev/.npm/_logs/2024-05-09T09_14_18_011Z-debug-0.log
TypeError: Cannot read properties of undefined (reading 'addBreadcrumb')

@joshuaellis joshuaellis added issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product status: pending reproduction Waiting for free time to reproduce the issue, or more information source: generators labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product source: generators status: pending reproduction Waiting for free time to reproduce the issue, or more information
Projects
Status: To be reviewed (Open)
Status: To review
Development

No branches or pull requests

6 participants