ns create cannot create a working project

Issue

I do the following:

ns create HelloNg --template @nativescript/template-tab-navigation-ng
ns create BlankNg --template @nativescript/template-blank-ng
ns create Blank --template @nativescript/template-blank
ns create Create
# allways finished with:
Project xyz was successfully created.
# after change the working directory to the project folder, i try to run/debug
ns run android
ns debug android

I have allways the same error: Cannot read properties of null (reading 'forEach')

ns doctor android output is: No issues were detected.

System: Ubuntu 20.04

NativeScript 8.2.2

npm 8.3.1

node v16.14.0

What can i do?

[edit]

$ ns clean
⠋ Cleaning project...
✔ Cleaned directory hooks
ℹ Skipping platforms because it doesn't exist.
✔ Cleaned directory node_modules
✔ Cleaned file package-lock.json
✔ Project successfully cleaned.
$ ns run android
Cannot read properties of null (reading 'forEach')
$ tns platform add android
Copying template files...
Cannot read properties of null (reading 'latest')
$ ns run android
Cannot read properties of null (reading 'forEach')
$ ns clean
⠋ Cleaning project...
ℹ Skipping hooks because it doesn't exist.
✔ Cleaned directory platforms
ℹ Skipping node_modules because it doesn't exist.
ℹ Skipping package-lock.json because it doesn't exist.
✔ Project successfully cleaned.

[edit]

Now with --log trace

$ ns debug android --log trace
TypeError: Cannot read properties of null (reading 'forEach')
    at Object.maxSatisfying (/usr/lib/node_modules/nativescript/node_modules/semver/ranges/max-satisfying.js:13:12)
    at PackageInstallationManager.<anonymous> (/usr/lib/node_modules/nativescript/lib/package-installation-manager.js:56:27)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/lib/node_modules/nativescript/lib/package-installation-manager.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Solution

I found the mistake. Node.js was installed as a snap package. This caused problems with various tools.

Now Node.js is installed in my home directory from node.tar.xz and everything works fine.

Answered By – bitkorn

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.