ns create cannot create a working project - nativescript

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)

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.

Cannot read properties of null (reading 'forEach')
This error sounds like something from your own code. You are using a forEach some where and the object is null. You can see excact line number if you go further up in the console log.

Related

my serverless.js is missing from node_modules

all. I'm new to nextJS deployment and the serverless.
In my NextJS project, I've installed serverless with the command "npm -g install serverless#2.72.2".
However, after I command with "sls", the error showed up as in the snip.
There is no folder #sls-next created in the node_moduels directory.
I've tried to manually create the file, but have no idea about the content in it.
How can I fix this?
❯ sls
error:
Error: No serverless.js file found in ./node_modules/#sls-next/serverless-component
at getAllComponents (/Users/icekubice/.nvm/versions/node/v17.1.0/lib/node_modules/serverless/node_modules/#serverless/template/utils.js:168:17)
at async Template.default (/Users/icekubice/.nvm/versions/node/v17.1.0/lib/node_modules/serverless/node_modules/#serverless/template/serverless.js:47:27)
at async Object.runComponents (/Users/icekubice/.nvm/versions/node/v17.1.0/lib/node_modules/serverless/node_modules/#serverless/cli/src/index.js:222:17)
0s › Template › Error: No serverless.js file found in ./node_modules/#sls-next/serverless-component
❯ sls -v
Framework Core: 2.72.2
Plugin: 5.5.4
SDK: 4.3.2
Components: 3.18.2

Nativescript Error: Executing webpack failed with exit code 1

I've done a fresh install of Nativescript on a new iMac (running Big Sur) following the instructions carefully (from https://docs.nativescript.org/environment-setup.html#macos-ios).
It was working fine after the install yesterday, but today I cannot run apps in ios simulator (or in an Android virtual device).
The ns doctor command in terminal gives me this initially:
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.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 12.5.1 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.0.2 version and is up to date.
However, when I create a new app (ns create) and then try to run in (ns run ios), I get this error: Executing webpack failed with exit code 1.
The error messages start with this: TypeError: Cannot read property 'resolved' of undefined.
The same thing is also happening when I try to run it on Android.
After trying to run it on both ios and Android, ns doctor adds these lines:
✔ Component #nativescript/core has 8.0.8 version and is up to date.
✔ Component #nativescript/ios has 8.0.0 version and is up to date.
✔ Component #nativescript/android has 8.0.0 version and is up to date.
So it seems like the platforms are being added properly.
Any help would be greatly appreciated!
The full error message is:
Searching for devices...
Preparing project...
webpack is watching the files...
/Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:817
if (entry.resolved !== undefined) return entry.resolved;
^
TypeError: Cannot read property 'resolved' of undefined
at getResolvedTimestamp (/Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:817:12)
at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:1167:21
at /Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:352:5
at Hook.eval [as callAsync] (eval at create (/Users/student/Desktop/testApp/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/student/Desktop/testApp/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
at AsyncQueue._handleResult (/Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:322:21)
at /Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:305:11
at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:3098:21
at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:3010:22
at /Users/student/Desktop/testApp/node_modules/neo-async/async.js:2830:7
at done (/Users/student/Desktop/testApp/node_modules/neo-async/async.js:2925:13)
at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:2994:23
at Array.<anonymous> (/Users/student/Desktop/testApp/node_modules/webpack/lib/util/fs.js:311:21)
at runCallbacks (/Users/student/Desktop/testApp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:27:15)
at /Users/student/Desktop/testApp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:200:4
at callback (/Users/student/Desktop/testApp/node_modules/graceful-fs/polyfills.js:299:20)
Executing webpack failed with exit code 1.
Thank you for reporting this, we have confirmed a breaking change in the latest webpack release:
https://github.com/webpack/webpack/releases/tag/v5.51.1
You can switch your package.json to use the rc as follows to resolve this right now:
"devDependencies": {
...
"#nativescript/webpack": "rc"
},
Then ns clean and you should be able to run your app now.
We also published another beta tag pinning webpack to 5.50.0 so doing ns clean without making any other dependency change in your own package.json should also work now.

Nativescript ios build fails with Error 65

I've run into an issue where suddenly my ios build will no longer build. It seems to have happened out of no-where.
I get this error and can't seem to get rid of it regardless of what I try.
[19-01-15 10:57:43.888] Build failed. Command xcodebuild failed with exit code 65 Error output:
** ARCHIVE FAILED **
I've tried tns platform remove ios
I've updated my plugins.
I also get these cli warnings before it fails:
(CLI) 1) Target 'class2tns' has copy command from ...
and
(CLI) warning: duplicate output file
for a number of files.
My Android version builds ok.
I had the same exit code from Xcode (65) and the warning of duplicate output file.
After along time of research the following steps are required because an update of a nativescript npm package.
rm -Rf platform/ios
rm -Rf node_modules
rm package-lock.json
pod repo update # important to execute this command in the project dir
tns build ios

nativescript 'tns run android' throws ClassNotFoundException

I did a fresh clone of the nativescript grocery git repo, and checked out the angualr-start branch, did 'platform add android', and then 'tns run android' (which my android device connected)
The app came up and displayed this error: pastebin.com/1YbThGkZ
perhaps the most significant part of the error being this:
java.lang.ClassNotFoundException: Didn't find class "com.tns.FragmentClass" on path: DexPathList[[zip file "/data/app/org.nativescript.groceries-1/base.apk"],nativeLibraryDirectories=[/data/app/org.nativescript.groceries-1/lib/arm, /data/app/org.nativescript.groceries-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /systementer code here/lib]]
Solution: upgrade to native script (and tns-core-modules) v2.1
upgrade to native script (and tns-core-modules) v2.1
sudo npm install nativescript -g --unsafe-perm
tns plugin remove tns-core-modules
tns plugin add tns-core modules

Xamarin iOS Framework Binding

I am trying to create a binding for the WePay Framework:
https://github.com/wepay/wepay-ios
Following are the steps that I followed.
I installed CocoaPods.
I installed ObjectiveSharpie
I run this command in terminal : $ sharpie pod init ios WePay
And I get this error: Could not install CocoaPod
here is the full error message:
** Setting up CocoaPods master repo ...
(this may take a while the first time)
Setting up CocoaPods master repo
$ /usr/bin/git pull --ff-only
From https://github.com/CocoaPods/Specs
ee36ba4..8c6767d master -> origin/master
Updating ee36ba4..8c6767d
Fast-forward
Specs/BluetoothKit/0.3.0/BluetoothKit.podspec.json | 35 ++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 Specs/BluetoothKit/0.3.0/BluetoothKit.podspec.json
Setup completed
** Searching for requested CocoaPods ...
** Working directory:
** - Writing Podfile ...
** - Installing CocoaPods ...
** (running pod install --no-integrate --no-repo-update)
[!] Unknown option: --no-integrate
Did you mean: --no-ansi?
Usage:
$ pod install
Downloads all dependencies defined in `Podfile` and creates an Xcode Pods
library project in `./Pods`.
The Xcode project file should be specified in your `Podfile` like this:
project 'path/to/XcodeProject.xcodeproj'
If no project is specified, then a search for an Xcode project will be
made. If more than one Xcode project is found, the command will raise an
error.
This will configure the project to reference the Pods static library, add
a build configuration file, and add a post build script to copy Pod
resources.
Options:
--repo-update Force running `pod repo update` before
install
--project-directory=/project/dir/ The path to the root of the project
directory
--silent Show nothing
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
error: could not install CocoaPod
Well apparently the most recent CocoaPods removed the --no-integrate option that objective sharpie uses. Downgrading cocoapods to 0.39.0 should fix your issue. It worked for us.

Resources