Skip to content

Commit 2e8f1af

Browse files
committed
update setup check
1 parent 5464e5f commit 2e8f1af

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

scripts/setup.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@ function color(modifier, string) {
1616

1717
console.log(color('info', '▶️ Starting workshop setup...'))
1818

19-
var error = spawnSync('npx --version', {shell: true}).stderr.toString().trim()
20-
if (error) {
19+
var output = spawnSync('npm --version', {shell: true}).stdout.toString().trim()
20+
var outputParts = output.split('.')
21+
var major = Number(outputParts[0])
22+
var minor = Number(outputParts[1])
23+
if (major < 8 || (major === 8 && minor < 16)) {
2124
console.error(
2225
color(
2326
'danger',
24-
'🚨 npx is not available on this computer. Please install npm@5.2.0 or greater',
27+
'🚨 npm version is ' +
28+
output +
29+
' which is out of date. Please install npm@8.16.0 or greater',
2530
),
2631
)
27-
throw error
32+
throw new Error('npm version is out of date')
2833
}
2934

3035
var command =

0 commit comments

Comments
 (0)