Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run SaaS connectors locally using npm run dev after node update #55

Open
mostafa-helmy-sp opened this issue Jul 30, 2024 · 0 comments

Comments

@mostafa-helmy-sp
Copy link

Following a recent Node update for a security vulnerability, running npm run dev now fails with the same errors listed here.

\colab-isc-advanced-policy-management-framework> npm run dev

> [email protected] dev
> cross-env NODE_OPTIONS=--enable-source-maps spcx run dist/index.js

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:760:9)
    at spawnTsc (C:\Users\mostafa.helmy\OneDrive - SailPoint Technologies, Inc\Documents\SailPointDev\colab-isc-advanced-policy-management-framework\node_modules\@sailpoint\connector-sdk\bin\spcx.ts:73:20)
    at runDev (C:\Users\mostafa.helmy\OneDrive - SailPoint Technologies, Inc\Documents\SailPointDev\colab-isc-advanced-policy-management-framework\node_modules\@sailpoint\connector-sdk\bin\spcx.ts:83:2)
    at Object.<anonymous> (C:\Users\mostafa.helmy\OneDrive - SailPoint Technologies, Inc\Documents\SailPointDev\colab-isc-advanced-policy-management-framework\node_modules\@sailpoint\connector-sdk\bin\spcx.ts:32:2)
    at Module._compile (node:internal/modules/cjs/loader:1504:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1588:10)
    at Module.load (node:internal/modules/cjs/loader:1282:32)
    at Module._load (node:internal/modules/cjs/loader:1098:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14) {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'spawn'
}

Node.js v22.5.1

The option { shell: true } should be added to the spawn code listed below

const tsc = spawn(/^win/.test(process.platform) ? 'tsc.cmd' : 'tsc', ['--inlineSourcemap', 'true', '--sourceMap', 'false', '--watch'])

Suggested code:

    /**
     * Spawns a child process that runs TypeScript compiler (tsc) with watch option and inlineSourcemap for debugging.
     * spawn will fail in pure JS projects as typescript devDependency is expected to be missing
     */
    const spawnTsc = () => {
        const tsc = (0, child_process_1.spawn)(/^win/.test(process.platform) ? 'tsc.cmd' : 'tsc', ['--inlineSourcemap', 'true', '--sourceMap', 'false', '--watch'], { shell: true })
            .once('spawn', () => {
                tsc.stdout.on('data', (data) => console.log(`tsc: ${data}`));
                tsc.stderr.on('data', (data) => console.error(`tsc: ${data}`));
            })
            .once('error', (ignored) => { });
        return tsc;
    };
    spawnTsc();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant