apptension / saas-boilerplate

SaaS Boilerplate - Open Source and free SaaS stack that lets you build SaaS products faster in React, Django and AWS. Focus on essential business logic instead of coding repeatable features!
https://apptension.com/saas-boilerplate
MIT License
1.92k stars 204 forks source link

Error after ''npm init saas-boilerplate''. I have all requirements #430

Open giuseppe-coco opened 7 months ago

giuseppe-coco commented 7 months ago

Describe the bug

postinstall$ node packages/internal/cli/scripts/build.js │ node:events:492 │ throw er; // Unhandled 'error' event │ ^ │ Error: spawn pnpm 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) { │ code: 'ENOENT', │ syscall: 'spawn pnpm', │ path: 'pnpm', │ spawnargs: [ 'run', 'build' ] │ } │ Node.js v20.9.0 └─ Failed in 179ms at C:\Users\ccpep\Desktop\saas-boilerplate Installing dependencies... ! Error: Command failed: pnpm i --frozen-lockfile npm ERR! code 1 npm ERR! path C:\Users\ccpep\Desktop\saas-boilerplate npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-saas-boilerplate

npm ERR! A complete log of this run can be found in: C:\Users\ccpep\AppData\Local\npm-cache_logs\2023-11-12T16_27_29_802Z-debug-0.log

Steps to reproduce

  1. Go to dir /saas-boilerplate
  2. Run npm init saas-boilerplate

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx
    Memory: 12.33 GB / 18.90 GB
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.10.3 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Spartan (44.19041.3570.0), Chromium (119.0.2151.58)
    Internet Explorer: 11.0.19041.3570

Logs

No response

Validations

mkleszcz commented 7 months ago

Hello @giuseppe-coco, I'm trying to reproduce your issue on the Windows machine but without any luck... Not sure might cause your issue but when looking into the code I see that there might be one line missing in packages/internal/cli/scripts/lib/runCommand.js. Could you modify this file (after the init script will copy the SB repository into your location) and add the following line:

shell: process.platform === 'win32',

after

stdio: 'inherit',

so the code will look like:

const cmd = spawn(command, args, {
      stdio: 'inherit',
      shell: process.platform === 'win32',
      ...options,
    });

Then, please run pnpm i and we'll see if the packages will build correctly

mm51165 commented 5 months ago

Hello @giuseppe-coco, I'm trying to reproduce your issue on the Windows machine but without any luck... Not sure might cause your issue but when looking into the code I see that there might be one line missing in packages/internal/cli/scripts/lib/runCommand.js. Could you modify this file (after the init script will copy the SB repository into your location) and add the following line:

shell: process.platform === 'win32',

after

stdio: 'inherit',

so the code will look like:

const cmd = spawn(command, args, {
      stdio: 'inherit',
      shell: process.platform === 'win32',
      ...options,
    });

Then, please run pnpm i and we'll see if the packages will build correctly

I had the same issue; this resolved it for me. I'm not sure how the line was missing for me since I've used the 'starter kit' setup.

giuseppe-coco commented 5 months ago

Hello @giuseppe-coco, I'm trying to reproduce your issue on the Windows machine but without any luck... Not sure might cause your issue but when looking into the code I see that there might be one line missing in packages/internal/cli/scripts/lib/runCommand.js. Could you modify this file (after the init script will copy the SB repository into your location) and add the following line:

shell: process.platform === 'win32',

after

stdio: 'inherit',

so the code will look like:

const cmd = spawn(command, args, {
      stdio: 'inherit',
      shell: process.platform === 'win32',
      ...options,
    });

Then, please run pnpm i and we'll see if the packages will build correctly

I modified the code as you wrote, but when I run pnpm i get an error : pnpm i
packages/webapp |  WARN  The field "pnpm" was found in C:\Users\ccpep\Desktop\projects\saas-boilerplate\packages\webapp/package.json. This will not take effect. You should configure "pnpm" at the root of the workspace instead. Scope: all 23 workspace projects Lockfile is up to date, resolution step is skipped Already up to date . postinstall$ node packages/internal/cli/scripts/build.js │ node:events:496 │ throw er; // Unhandled 'error' event │ ^ │ Error: spawn pnpm 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: -4058, │ code: 'ENOENT', │ syscall: 'spawn pnpm', │ path: 'pnpm', │ spawnargs: [ 'run', 'build' ] │ } │ Node.js v20.11.0 └─ Failed in 72ms at C:\Users\ccpep\Desktop\projects\saas-boilerplate  ELIFECYCLE  Command failed with exit code 1.