Sitecore / jss

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

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

Open bstaruk opened 4 weeks ago

bstaruk commented 4 weeks 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 2 weeks 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.