Sitecore / jss

Software development kit for JavaScript developers building web applications with Sitecore Experience Platform
https://jss.sitecore.com
Apache License 2.0
263 stars 275 forks source link

Cannot Initialize New Project w/ Next.js & nextjs-styleguide #1825

Open bstaruk opened 5 months ago

bstaruk commented 5 months ago

Describe the Bug

It is currently impossible to initialize and start a new JSS project on a Macbook with an Apple Silicon chip, using Next.js and the nextjs-styleguide boilerplate.

To Reproduce

  1. Initialize a fresh project with the current settings. Everything was left default, except for selecting the nextjs-styleguide addon initializer in the last step:

    Screenshot 2024-06-17 at 12 43 52 PM
  2. cd nextjs to navigate into the project directory

  3. npm run start to start the project

This results in:

> sitecore-jss-app@22.0.0 start
> cross-env NODE_ENV=development JSS_MODE=disconnected "npm-run-all --serial bootstrap --parallel next:dev start:disconnected-proxy start:watch-components"

node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: spawn npm-run-all --serial bootstrap --parallel next:dev start:disconnected-proxy start:watch-components ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn npm-run-all --serial bootstrap --parallel next:dev start:disconnected-proxy start:watch-components',
  path: 'npm-run-all --serial bootstrap --parallel next:dev start:disconnected-proxy start:watch-components',
  spawnargs: []
}

Node.js v20.14.0

Expected Behavior

Given this is a fresh installation, the app should run without erroring/crashing.

Possible Fix

No response

Provide environment information

art-alexeyenko commented 4 months ago

@bstaruk Thank you for the report. We saw some issues with config formattign causing build issues on Macs. They should be fixed via https://github.com/Sitecore/jss/pull/1791 and included in the next upcoming release. You can apply it ( extra .trim() in scripts/generate-config) right now however, the fix is app-level only.

bnmn1895 commented 3 months ago

I am running into the same issue even after applying the fix with adding the .trim(). Is there any update on this?

yavorsk commented 3 months ago

Hi @bnmn1895, what version of jss are you using? The fix for this issue is part of v22.1.0.

bnmn1895 commented 3 months ago

I tried following the docs so I guess it still was v21.x.