Picture of Rob Mausser
Error creating course with latest NodeJS LTE
by Rob Mausser - Wednesday, 7 August 2024, 6:25 PM
 

Updated Node JS to the latest LTE and this is what I get when I try to "adapt create course"

 

? create now? Yes
downloading adapt_framework to C:\D\SVN\Adapt Playground\my-adapt-course
done!
installing node dependencies
Oh dear, something went wrong. I'm terribly sorry. spawn EINVAL
Error: spawn EINVAL
at ChildProcess.spawn (node:internal/child_process:421:11)
at spawn (node:child_process:761:9)
at file:///C:/Users/Bort/AppData/Roaming/npm/node_modules/adapt-cli/lib/integration/AdaptFramework/npmInstall.js:12:17
at new Promise (<anonymous>)
at npmInstall (file:///C:/Users/Bort/AppData/Roaming/npm/node_modules/adapt-cli/lib/integration/AdaptFramework/npmInstall.js:10:9)
at course (file:///C:/Users/Bort/AppData/Roaming/npm/node_modules/adapt-cli/lib/commands/create/course.js:14:9)
at async Object.create (file:///C:/Users/Bort/AppData/Roaming/npm/node_modules/adapt-cli/lib/commands/create.js:42:5)
at async CLI.execute (file:///C:/Users/Bort/AppData/Roaming/npm/node_modules/adapt-cli/lib/cli.js:62:7) {
errno: -4071,
code: 'EINVAL',
syscall: 'spawn'
}

Picture of Rob Mausser
Re: Error creating course with latest NodeJS LTE
by Rob Mausser - Wednesday, 7 August 2024, 6:54 PM
 

Hi, I fixed this by adding "shell: true" to npminstall.js

 

import chalk from 'chalk'
import { spawn } from 'child_process'
import path from 'path'

export default async function npmInstall ({
logger,
cwd
} = {}) {
cwd = path.resolve(process.cwd(), cwd)
await new Promise((resolve, reject) => {
logger?.log(chalk.cyan('installing node dependencies'))
const npm = spawn((process.platform === 'win32' ? 'npm.cmd' : 'npm'), ['--unsafe-perm', 'install'], {
stdio: 'inherit',
shell: true,
cwd
})
npm.on('close', code => {
if (code) return reject(new Error('npm install failed'))
resolve()
})
})
}

Picture of Oliver Foster
Re: Error creating course with latest NodeJS LTE
by Oliver Foster - Wednesday, 7 August 2024, 7:10 PM
 

Which version of node and windows?

Which shell are you using? cmd? git-bash?

Picture of Rob Mausser
Re: Error creating course with latest NodeJS LTE
by Rob Mausser - Thursday, 8 August 2024, 3:46 PM
 

The current LTE v20.16.0 on the latest Windows 11

Using CMD.