near-cli
near-cli copied to clipboard
State the minimal required Node.js version in the README
It would be great to also integrate the check into the near-shell itself, so it does not produce cryptic errors like:
$ near new_project staking
node: bad option: --experimental-repl-await
It seems that Node.js 10+ is now required.
Added to package.json
for now https://github.com/nearprotocol/near-shell/blob/master/package.json#L6
Good point about better runtime check. Kinda can live without that flag, but never tested on anything smaller than 10. It's not even current LTS anymore :)
if we keep seeing this issue we can try adding engineStrict = true
@amgando this happens before we are even in Node.js code though
oh. it's here, my bad
#!/bin/sh
CLI_PATH="$(dirname "$0")"/near-cli.js
node --experimental-repl-await "$CLI_PATH" "$@"
how complicated do we want to make the bootstrapping script?
here's a little something i like to call overkill
requirement 1: node
near@everywhere:$ near
NEAR Shell requires node
Please get it here: https://nodejs.org/en/download
requirement 2: min version
near@everywhere:$ near
NEAR Shell requires node version 10 or greater
You currently have node v8.16.2 installed
Kindly upgrade your node environment ftw
all requirements met: NEAR Shell launches
note: this was only tested on one machine
Darwin machbuch.local 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64
#!/bin/sh
set -e
# configure requirements
REQUIRED_NODE_VERSION=10
# --------------------------------
function missing {
local return_=1
type $1 >/dev/null 2>&1 || { local return_=0; }
return $return_
}
function launch_near_shell {
CLI_PATH="$(dirname "$0")"/near-cli.js
node --experimental-repl-await "$CLI_PATH" "$@"
}
# --------------------------------
if missing node; then
echo
echo "NEAR Shell requires node"
echo "https://nodejs.org/en/download"
echo
else
version=`node -v`
major=${version:1:2}
if [ $major -ge $REQUIRED_NODE_VERSION ]
then
launch_near_shell
else
echo
echo "NEAR Shell requires node version $REQUIRED_NODE_VERSION or greater"
echo "You currently have node $version installed"
echo "Kindly upgrade your node environment ftw"
echo
fi
fi
@amgando your solution implies that sh is available. Is it always the case for node environments on Windows? (Does near-shell work on Windows?)
@frol not sure, will try to setup AppVeyor this week for CI to include windows unless we already have something going to answer this question.
@amgando I suggest we better use GitHub Actions. It is a new built-in CI with all three major platforms available.
oh? perfect, i'll look at that then, thanks!
I’d prefer we stick to Travis. They also have windows env available afaik.
I have just searched and indeed there is an early preview of Windows support on Travis. What are the concerns about Github Actions? We use it for Explorer and it seem to work just fine.
@frol Travis has better UX IMO, but yeah difference is small. However I feel a bit uneasy about MS owning yet another part of dev stack :/
Confirmed that adding engineStrict = true doesn't solve the problem.
Needs bump to 12.