I'm trying to create a new project with NativeScript and Angular. I have installed what is described here.
When I run the command tns doctor
everything is fine. There it is the result:
✔ Getting environment information
No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.7.0 version and is up to date.
But when I run tns create
after setting the name and the type (Angular) of the project then I select the Hello World template, it gives me
spawn EINVAL
Is there a solution?
I'm using Windows 11.
node -v
v20.12.2
npm -v
10.5.2
EDIT
I run this command
tns build android --log trace
And now I have these info:
Failed to build plugin @nativescript/core :
Error: spawn EINVAL
Error: Failed to build plugin @nativescript/core :
Error: spawn EINVAL
at Errors.failWithOptions (C:\Users\giada\AppData\Roaming\npm\node_modules\nativescript\lib\common\errors.js:165:27)
at Errors.fail (C:\Users\giada\AppData\Roaming\npm\node_modules\nativescript\lib\common\errors.js:137:21)
at AndroidPluginBuildService.<anonymous> (C:\Users\giada\AppData\Roaming\npm\node_modules\nativescript\lib\services\android-plugin-build-service.js:508:30)
at Generator.throw (<anonymous>)
at rejected (C:\Users\giada\AppData\Roaming\npm\node_modules\nativescript\lib\services\android-plugin-build-service.js:12:65)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
In addition, I downgraded npm. Now I have the 10.3.0 version
The problem seems to be related to an CVE that requires node to pass: { shell: true } in the child_process.spawn options. This vulnerability fix only applies on node 18, 20 and 21.
Wednesday, April 10, 2024 Security Releases
I solved it by downgrading to node 16 and wait for an update of nativescript.