Welcome to the Linux Foundation Forum!

nsd-check script not working on windows 11

In the "Creating a Web Server" "Creating a Web Server with Node Core (2)" page we are required to run "npm nsd-check" but it does not run successfully on my machine:

Edition Windows 11 Pro
Version 23H2
OS build    22631.3958
Experience  Windows Feature Experience Pack 1000.22700.1026.0

Error:

npx nsd-check
running `npm start` in current working directory (stdio:'inherit'):
node:internal/child_process:421
    throw new ErrnoException(err, 'spawn');
          ^
Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at startServer (file:///..replace_with_path_to_project../node_modules/nsd-check/index.js:25:18)
    at file:///..replace_with_path_to_project../node_modules/nsd-check/bin.js:3:1
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'spawn'
}

Comments

  • xdxmxc
    xdxmxc Posts: 157

    @olegk96 the command is npx nsd-check not npm nsd-check - confirmed as working on Windows.

  • @olegk96 A solution that worked for me from github issue: edit the startServer function of nsd-check/index.js
    file: node_modules/nsd-check/index.js

    export function startServer (cwd = process.cwd()) {
    console.log('running npm start in current working directory (stdio:\'inherit\'):')
    childProcess = spawn(which.sync('npm'), ['start'], {
    stdio: 'inherit',
    cwd,
    env: { ...process.env, PORT },

    shell: true

    })
    ...
    }

Categories

Upcoming Training