mm_ss.0291
mm_ss.0291

Reputation: 3

Terrafrom cdktf-cli install errors

Good day all,

I'd like to get the Terraform CDK installed on a Windows 11 machine so that I can test using Python to deploy infrastructure.

I am trying to follow the official Terraform CDK installation documentation, consistently getting the warning and errors below when attempting to run the npm install --global cdktf-cli@latest command as administrator:

npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     '\\\\?\\C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\validator\es\lib'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\validator\\es\\lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '\\\\?\\C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@cdktf\node-pty-prebuilt-multiarch\deps\winpty'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@cdktf\\node-pty-prebuilt-multiarch\\deps\\winpty' npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '\\\\?\\C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@babel\\parser',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@babel\parser\node_modules\@babel\types'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@babel\\parser\\node_modules\\@babel\\types'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\cdktf\node_modules\lazystream\node_modules'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\cdktf\\node_modules\\lazystream\\node_modules'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '\\\\?\\C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@inquirer',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@inquirer\checkbox\node_modules\@inquirer\core'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@inquirer\\checkbox\\node_modules\\@inquirer\\core'npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '\\\\?\\C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@inquirer\\confirm',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@inquirer\confirm'] { npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@inquirer\\confirm'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '\\\\?\\C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@inquirer\\checkbox',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@inquirer\checkbox\node_modules'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\cdktf-cli\\node_modules\\@inquirer\\checkbox\\node_modules'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm error code 1
npm error path C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@cdktf\node-pty-prebuilt-multiarch
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/check-prebuild.js || prebuild-install || node scripts/install.js
npm error Prebuild binary missing for platform win32
npm error prebuild-install warn install No prebuilt binaries found (target=22.14.0 runtime=node arch=x64 libc= platform=win32)
npm error node:internal/child_process:420
npm error     throw new ErrnoException(err, 'spawn');
npm error     ^
npm error
npm error Error: spawn EINVAL
npm error     at ChildProcess.spawn (node:internal/child_process:420:11)
npm error     at spawn (node:child_process:753:9)
npm error     at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\cdktf-cli\node_modules\@cdktf\node-pty-prebuilt-multiarch\scripts\install.js:11:20)
npm error     at Module._compile (node:internal/modules/cjs/loader:1554:14)
npm error     at Object..js (node:internal/modules/cjs/loader:1706:10)
npm error     at Module.load (node:internal/modules/cjs/loader:1289:32)
npm error     at Function._load (node:internal/modules/cjs/loader:1108:12)
npm error     at TracingChannel.traceSync (node:diagnostics_channel:322:14)
npm error     at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
npm error     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5) {
npm error   errno: -4071,
npm error   code: 'EINVAL',
npm error   syscall: 'spawn'
npm error }

Not sure what missing binary is required for this to work. Also, unsure of how concerned I should be with the permission related warnings for the "cleanup" activity above the error.

Any help would be greatly appreciated.

Upvotes: 0

Views: 60

Answers (1)

Thomas Wright
Thomas Wright

Reputation: 1

You need to downgrade to node version 20.12.1

As since after this version a CVE was patched causing the child dependency node-pty-prebuilt-multiarch to fail due to it's install script.

Node Security Release

Upvotes: 0

Related Questions