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

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

Open
5 tasks done
giuseppe-coco opened this issue Nov 12, 2023 · 4 comments
Open
5 tasks done
Labels
bug Something isn't working

Comments

@giuseppe-coco
Copy link

giuseppe-coco commented Nov 12, 2023

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
Copy link
Contributor

mkleszcz commented Dec 6, 2023

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

@mkleszcz mkleszcz added the bug Something isn't working label Dec 6, 2023
@mm51165
Copy link

mm51165 commented Jan 16, 2024

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
Copy link
Author

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.

@avan4457
Copy link

avan4457 commented Nov 9, 2024

Hey guys, I am getting the same issue. I tried all 3 methods with npm, pnpm and yarn as well. All the requirements stated are there in my local machine. ( windows 10 64bit )

image

Here's the complete log below,

0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 silly config load:file:C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\npmrc
4 silly config load:file:C:\Users\avantha's HP15\anatomea\.npmrc
5 silly config load:file:C:\Users\avantha's HP15\.npmrc
6 silly config load:file:C:\Program Files\nodejs\etc\npmrc
7 verbose title npm init saas-boilerplate .
8 verbose argv "init" "saas-boilerplate" "."
9 verbose logfile logs-max:10 dir:C:\Users\avantha's HP15\AppData\Local\npm-cache\_logs\2024-11-09T07_36_59_400Z-
10 verbose logfile C:\Users\avantha's HP15\AppData\Local\npm-cache\_logs\2024-11-09T07_36_59_400Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly logfile done cleaning log files
13 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
14 http fetch GET 200 https://registry.npmjs.org/create-saas-boilerplate 1378ms (cache revalidated)
15 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
16 verbose stack Error: command failed
16 verbose stack     at promiseSpawn (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:22:22)
16 verbose stack     at spawnWithShell (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:124:10)
16 verbose stack     at promiseSpawn (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:12:12)
16 verbose stack     at runScriptPkg (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script-pkg.js:77:13)
16 verbose stack     at runScript (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script.js:9:12)
16 verbose stack     at run (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\node_modules\libnpmexec\lib\run-script.js:48:10)
16 verbose stack     at async exec (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\node_modules\libnpmexec\lib\index.js:293:10)
16 verbose stack     at async Init.execCreate (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\lib\commands\init.js:136:5)
16 verbose stack     at async Init.exec (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\lib\commands\init.js:44:14)
16 verbose stack     at async Npm.exec (C:\Users\avantha's HP15\AppData\Roaming\nvm\v20.12.2\node_modules\npm\lib\npm.js:207:9)
17 error code 1
18 error path C:\Users\avantha's HP15\anatomea
19 error command failed
20 error command C:\Windows\system32\cmd.exe /d /s /c create-saas-boilerplate .
21 verbose cwd C:\Users\avantha's HP15\anatomea
22 verbose os Windows_NT 10.0.19045
23 verbose node v20.12.2
24 verbose npm  v10.8.2
25 verbose exit 1
26 verbose code 1
27 error A complete log of this run can be found in: C:\Users\avantha's HP15\AppData\Local\npm-cache\_logs\2024-11-09T07_36_59_400Z-debug-0.log

Device and OS info below,

image

Any help would be appreciated. Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants