Skip to content

Instantly share code, notes, and snippets.

@shershen08
Last active January 18, 2024 20:35
Show Gist options
  • Save shershen08/1a9d3fc72e81d51c35b1a27a5d83a7bb to your computer and use it in GitHub Desktop.
Save shershen08/1a9d3fc72e81d51c35b1a27a5d83a7bb to your computer and use it in GitHub Desktop.
fix ts-node not installed error
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -z "$NODE_PATH" ]; then
export NODE_PATH="<some_path>common/cli/node_modules:<some_path>common/node_modules:<some_path>node_modules:<some_path>/node_modules:<some_path>node_modules:/Users/node_modules:/node_modules:<some_path>Library/pnpm/global/5/.pnpm/node_modules"
else
export NODE_PATH="<some_path>common/cli/node_modules:<some_path>common/node_modules:<some_path>node_modules:<some_path>/node_modules:<some_path>node_modules:/Users/node_modules:/node_modules:<some_path>Library/pnpm/global/5/.pnpm/node_modules:$NODE_PATH"
fi
# check if ts-node is installed
which ts-node
if [[ $? != 0 ]]; then
echo "\n ts-node is not installed, please install 'ts-node' globally first"
exit 1
fi
if [ -x "$basedir/ts-node" ]; then
exec "$basedir/ts-node" "$basedir/../../../../../Library/pnpm/global/5/node_modules/@juicyllama/cli/cli.ts" "$@"
else
exec ts-node "$basedir/../../../../../Library/pnpm/global/5/node_modules/@juicyllama/cli/cli.ts" "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment