create wrapper around kitten-npm so kitten-node is always used #303

Open
wunter8 wants to merge 1 commit from wunter8/kitten-app:kitten-npm-wrapper into main
First-time contributor

I had node installed on my computer before installing Kitten. When I would run kitten-npm, it would use the previously-installed node instead of kitten-node.

This changes kitten-npm from a simple symlink into a simple bash script that makes sure to prepend the KITTEN_RUNTIME_BINARIES_PATH to the PATH env variable before calling kitten-npm so that the version of node installed by kitten is always used when kitten-npm is called.

This is basically replicating the functionality that already exists here:

Lines 267 to 281 in 8c4e473
export function npm (command, modulePath) {
const env = Object.assign(process.env, {NODE_OPTIONS: ''})
env.PATH = `${paths.KITTEN_RUNTIME_BIN_DIRECTORY}:${env.PATH}`
try {
childProcess.execSync(`${kittenNpm} ${command}`, {
encoding: 'utf-8',
env,
cwd: modulePath
})
return true
} catch (error) {
console.error(`npm ${command} failed on path ${modulePath}`, error)
return false
}
}

I had `node` installed on my computer before installing Kitten. When I would run `kitten-npm`, it would use the previously-installed `node` instead of `kitten-node`. This changes `kitten-npm` from a simple symlink into a simple bash script that makes sure to prepend the KITTEN_RUNTIME_BINARIES_PATH to the PATH env variable before calling `kitten-npm` so that the version of `node` installed by kitten is always used when `kitten-npm` is called. This is basically replicating the functionality that already exists here: https://codeberg.org/kitten/app/src/commit/8c4e473c4cf63c8b732773bc246287eae89ec998/src/Utils.js#L267-L281
wunter8 force-pushed kitten-npm-wrapper from 124645cab3 to c8f7e5a274 2025-12-24 22:00:58 +01:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u kitten-npm-wrapper:wunter8-kitten-npm-wrapper
git switch wunter8-kitten-npm-wrapper

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff wunter8-kitten-npm-wrapper
git switch wunter8-kitten-npm-wrapper
git rebase main
git switch main
git merge --ff-only wunter8-kitten-npm-wrapper
git switch wunter8-kitten-npm-wrapper
git rebase main
git switch main
git merge --no-ff wunter8-kitten-npm-wrapper
git switch main
git merge --squash wunter8-kitten-npm-wrapper
git switch main
git merge --ff-only wunter8-kitten-npm-wrapper
git switch main
git merge wunter8-kitten-npm-wrapper
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kitten/app!303
No description provided.