Skip to content

fix: improve error handling in post-install script #3385

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kaushal-26
Copy link

Summary:

Issue Reference(s):
Fixes #3384

  • As fixed js file not configured below commands

Build & Testing:

  • I ran cargo test successfully.
  • I have run ./lint.sh --mode=fix to fix all linting issues raised by ./lint.sh --mode=check.

Checklist:

  • I have added relevant unit & integration tests.
  • I have updated the documentation accordingly.
  • I have performed a self-review of my code.
  • PR follows the naming convention of <type>(<optional scope>): <title>

Copy link

blar-app bot commented May 5, 2025

PR author doesn't have a seat in Blar. You can change this in https://app.blar.io/settings

@github-actions github-actions bot added the type: fix Iterations on existing features or infrastructure. label May 5, 2025
Copy link

blar-app bot commented May 5, 2025

🦜 Time to pond-er this PR! Diving in to see if the error handling swims smoothly. Starting the review now.

Copy link

blar-app bot commented May 5, 2025

Alright, this PR's got more fixes than a cat with a laser pointer! I'm diving in now—get ready for a review from your friendly neighborhood frog.

@blar-app blar-app bot added size S Pull Request size is Small Impact XS The PR impact is very low labels May 5, 2025
Copy link

blar-app bot commented May 5, 2025

This PR improves error handling in the post-install script by addressing multiple issues. It throws an error if MSVC is not found on Windows, defines the previously undefined 'version' variable, and ensures the process exits with code 1 when 'npm i' fails due to 'execa' errors, which can sometimes throw 'undefined' errors. These changes enhance the robustness and reliability of the installation process, fix an issue referenced as #3384, and ensure better error visibility and handling during build and setup procedures.

Pull Request Impact: 0
We measure the impact of a Pull Request on the codebase by counting the number of references to the changed code.

🔄 File Changes Overview
File Description
npm/post-install.js Enhanced error handling in the post-install script by removing the specific version from the npm install command and adding process termination on failure.
📜 Blar Instructions

Blar Commands

  • Comment -blar --review triggers a review of the Pull Request, analyzing only the unreviewed commits since the last review.
  • Comment -blar --review --force to receive a complete review of the entire Pull Request, reanalyzing all commits.

Tags Explanation

  • 🐛 Debugger Agent Issues:
    These issues are identified by our Debugger Agent, which focuses on detecting bugs and errors in your code.
    Solutions for 🐛 issues are available upon request using the -blar --fix command.

  • ⚡ Optimizer Agent Issues:
    These issues focus on identifying inefficient database queries that can impact performance.
    Solutions for ⚡ issues are available upon request using the -blar --fix command.

  • 🛡️ Cyber Security Agent Issues:
    These issues focus on identifying potential security vulnerabilities in your code.
    Solutions for 🛡️ issues are available upon request using the -blar --fix command.

  • 🎨 Design Pattern Reviewer Agent Issues:
    These issues highlight concerns related to improper or suboptimal use of design patterns, evaluated based on rules set in the wiki.
    Solutions for 🎨 issues are available upon request using the -blar --fix command.

Copy link

blar-app bot commented May 5, 2025

✅ No debugger issues found 🐛
✅ No design pattern issues found 🎨

Review's done! 🚀 Check out the feedback and let me know if you need anything! – Blar

@Kaushal-26
Copy link
Author

@tusharmath any reason you feel this is incorrect?

  • I did this bcoz when I do npm install -g @tailcallhq/core-win32-x64-msvc --verbose, it breaks exit-code: 1
    PS C:\Users\Kaushal> npm install -g @tailcallhq/core-win32-x64-msvc --verbose
    npm verbose cli C:\nvm4w\nodejs\node.exe C:\nvm4w\nodejs\node_modules\npm\bin\npm-cli.js
    npm info using [email protected]
    npm info using [email protected]
    npm verbose title npm install @tailcallhq/core-win32-x64-msvc
    npm verbose argv "install" "--global" "@tailcallhq/core-win32-x64-msvc" "--loglevel" "verbose"
    npm verbose logfile logs-max:10 dir:C:\Users\Kaushal\AppData\Local\npm-cache\_logs\2025-05-06T16_18_50_145Z-
    npm verbose logfile C:\Users\Kaushal\AppData\Local\npm-cache\_logs\2025-05-06T16_18_50_145Z-debug-0.log
    npm http cache https://registry.npmjs.org/@tailcallhq%2fcore-win32-x64-msvc 44ms (cache hit)
    npm verbose stack Error: Unsupported platform
    npm verbose stack     at checkPlatform (C:\ProgramData\nvm\v22.14.0\node_modules\npm\node_modules\npm-install-checks\lib\index.js:42:25)
    npm verbose stack     at #checkEngineAndPlatform (C:\ProgramData\nvm\v22.14.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:212:9)
    npm verbose stack     at Arborist.buildIdealTree (C:\ProgramData\nvm\v22.14.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:184:41)
    npm verbose stack     at async Arborist.reify (C:\ProgramData\nvm\v22.14.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:131:5)
    npm verbose stack     at async Install.exec (C:\ProgramData\nvm\v22.14.0\node_modules\npm\lib\commands\install.js:150:5)
    npm verbose stack     at async Npm.exec (C:\ProgramData\nvm\v22.14.0\node_modules\npm\lib\npm.js:207:9)
    npm verbose stack     at async module.exports (C:\ProgramData\nvm\v22.14.0\node_modules\npm\lib\cli\entry.js:74:5)
    npm verbose pkgid @tailcallhq/[email protected]
    npm error code EBADPLATFORM
    npm error notsup Unsupported platform for @tailcallhq/[email protected]: wanted {"os":"win32","cpu":"x64","libc":"msvc"} (current: {"os":"win32","cpu":"x64"})
    npm error notsup Valid os:    win32
    npm error notsup Actual os:   win32
    npm error notsup Valid cpu:   x64
    npm error notsup Actual cpu:  x64
    npm error notsup Valid libc:  msvc
    npm error notsup Actual libc: undefined
    npm verbose cwd C:\Users\Kaushal
    npm verbose os Windows_NT 10.0.26100
    npm verbose node v22.14.0
    npm verbose npm  v10.9.2
    npm verbose exit 1
    npm verbose code 1
  • But when I do npm i -g @tailcallhq/tailcall --verbose, it doesn't breaks the postinstall as exit-code: 0
    PS C:\Users\Kaushal> npm i -g @tailcallhq/tailcall --verbose
    npm verbose cli C:\nvm4w\nodejs\node.exe C:\nvm4w\nodejs\node_modules\npm\bin\npm-cli.js
    npm info using [email protected]
    npm info using [email protected]
    npm verbose title npm i @tailcallhq/tailcall
    npm verbose argv "i" "--global" "@tailcallhq/tailcall" "--loglevel" "verbose"
    npm verbose logfile logs-max:10 dir:C:\Users\Kaushal\AppData\Local\npm-cache\_logs\2025-05-06T16_19_45_521Z-
    npm verbose logfile C:\Users\Kaushal\AppData\Local\npm-cache\_logs\2025-05-06T16_19_45_521Z-debug-0.log
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2ftailcall 2338ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/detect-libc 185ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@scarf%2fscarf 552ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-linux-x64-gnu 1772ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-linux-x64-musl 1891ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-linux-ia32-gnu 2197ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-darwin-arm64 2108ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-linux-arm64-gnu 2317ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-linux-arm64-musl 2356ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-darwin-x64 2159ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-win32-x64-msvc 2077ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-win32-arm64-msvc 2164ms (cache updated)
    npm http fetch GET 200 https://registry.npmjs.org/@tailcallhq%2fcore-win32-ia32-msvc 2123ms (cache updated)
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-win32-x64-msvc
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-win32-ia32-msvc
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-win32-arm64-msvc
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-linux-x64-musl
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-linux-x64-gnu
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-linux-ia32-gnu
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-linux-arm64-musl
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-linux-arm64-gnu
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-darwin-x64
    npm verbose reify failed optional dependency C:\ProgramData\nvm\v22.14.0\node_modules\@tailcallhq\tailcall\node_modules\@tailcallhq\core-darwin-arm64
    npm http cache detect-libc@https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz 1ms (cache hit)
    npm http cache @tailcallhq/tailcall@https://registry.npmjs.org/@tailcallhq/tailcall/-/tailcall-1.6.10.tgz 0ms (cache hit)
    npm http cache @scarf/scarf@https://registry.npmjs.org/@scarf/scarf/-/scarf-1.4.0.tgz 0ms (cache hit)
    npm info run @tailcallhq/[email protected] preinstall node_modules/@tailcallhq/tailcall node ./scripts/pre-install.js
    npm info run @tailcallhq/[email protected] preinstall { code: 0, signal: null }
    npm info run @tailcallhq/[email protected] postinstall node_modules/@tailcallhq/tailcall node ./scripts/post-install.js
    npm info run @scarf/[email protected] postinstall node_modules/@tailcallhq/tailcall/node_modules/@scarf/scarf node ./report.js
    npm info run @tailcallhq/[email protected] postinstall { code: 0, signal: null }
    npm info run @scarf/[email protected] postinstall { code: 0, signal: null }
    
    changed 3 packages in 14s
    npm verbose cwd C:\Users\Kaushal
    npm verbose os Windows_NT 10.0.26100
    npm verbose node v22.14.0
    npm verbose npm  v10.9.2
    npm verbose exit 0
    npm info ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Impact XS The PR impact is very low size S Pull Request size is Small type: fix Iterations on existing features or infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tailcall CLI command not recognized
1 participant