Nativescript Error: Executing webpack failed with exit code 1 - nativescript

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.

Related

Flutter project failing to build on Mac M1

I have recently bought a new Mac book with the M1 chip and faced huge issues between Flutter and Firebase in building. I will list both the Flutter error log and Xcode error log.
Note: I'm building on Flutter channel Master
Flutter Error Log:
Launching lib/main.dart on iPod touch (7th generation) in debug mode...
Xcode build done. 69.1s
Failed to build iOS app
Error output from Xcode build:
objc[30795]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1fe91f8f0) and ?? (0x1189402b8). One of the two will be used. Which one is undefined.
objc[30795]: Class AMSupportURLSession is implemented in both ?? (0x1fe91f940) and ?? (0x118940308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPlugin.m:141:20: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
[[[UIAlertView alloc] initWithTitle:#"Error"
^
In module 'UIKit' imported from /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/Target Support Files/image_picker/image_picker-prefix.pch:2:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
#interface UIAlertView : UIView
^
1 warning generated.
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.m:17:44: warning: 'UIImagePickerControllerReferenceURL' is deprecated: first deprecated in iOS 11.0 - Will be removed in a future release, use PHPicker. [-Wdeprecated-declarations]
NSURL *referenceURL = [info objectForKey:UIImagePickerControllerReferenceURL];
^
In module 'UIKit' imported from /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/Target Support Files/image_picker/image_picker-prefix.pch:2:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIImagePickerController.h:62:51: note: 'UIImagePickerControllerReferenceURL' has been explicitly marked deprecated here
UIKIT_EXTERN UIImagePickerControllerInfoKey const UIImagePickerControllerReferenceURL API_DEPRECATED("Will be removed in a future release, use PHPicker.", ios(4.1, 11.0)) API_UNAVAILABLE(tvos); // an NSURL that references an asset in the AssetsLibrary framework
^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.m:21:47: warning: 'fetchAssetsWithALAssetURLs:options:' is deprecated: first deprecated in iOS 11 - Will be removed in a future release [-Wdeprecated-declarations]
PHFetchResult<PHAsset *> *result = [PHAsset fetchAssetsWithALAssetURLs:#[ referenceURL ]
^
In module 'Photos' imported from /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.h:6:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h:74:1: note: 'fetchAssetsWithALAssetURLs:options:' has been explicitly marked deprecated here
+ (PHFetchResult<PHAsset *> *)fetchAssetsWithALAssetURLs:(NSArray<NSURL *> *)assetURLs options:(nullable PHFetchOptions *)options API_DEPRECATED("Will be removed in a future release", ios(8, 11), tvos(8, 11)) API_UNAVAILABLE(macos);
^
2 warnings generated.
1 warning generated.
error: the following command failed with exit code 0 but produced no further output
CompileC /Users/wissamboughannam/Library/Developer/Xcode/DerivedData/Runner-awkucyxpawezvvfjchbivjxuwsah/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/file_picker.build/Objects-normal/x86_64/FilePickerPlugin.o /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.4.2/ios/Classes/FilePickerPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
/Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRLogger.m:58:28: warning: this old-style function definition is not preceded by a prototype [-Wstrict-prototypes]
void FIRLoggerInitializeASL() {
^
/Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRLogger.m:101:20: warning: this old-style function definition is not preceded by a prototype [-Wstrict-prototypes]
void FIRResetLogger() {
^
2 warnings generated.
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
: context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
note: Removed stale file
As for the Error log from Xcode:
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Users/wissamboughannam/Developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
: context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
This is the main error, there were many warning, but I'm not sure if they're causing the build failure.
Running flutter doctor result:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.1.0-11.0.pre.227, on macOS 11.1 20C69 darwin-arm, locale en-SA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)
• No issues found!
As we know that m1 mac runs on arm based processor and thus few things like cocoa pods and ffi needs to be build based on that.
After a long research i came up with few steps which will definitely help everytime you stuck with xcode flutter application build for m1 mac.
To install completely cocoapods on Mac with M1 chip (Apple Silicon), please follow those steps:
Cocoa Pods Installation in M1
sudo gem install cocoapods
sudo gem install ffi
arch -x86_64 sudo gem install cocoapods -n /usr/local/bin
sudo gem install cocoapods -n /usr/local/bin
Install ffi
sudo arch -x86_64 gem install ffi
#update repo
arch -x86_64 pod install --repo-update
Flutter iOS builds
flutter clean
flutter build ios
Re-install dependency in iOS folder of flutter project
arch -x86_64 pod install
I also have an M1 Mac, and am on the stable channel, without any errors.
Try switching to stable first.
Also, try running $ flutter clean and again building the app.
I removed all depreciations and the project ran perfectly.
i had another issue related to flutter dependency that showing error OBJC_CLASS on firebase dependency, image cropper, stripe, etc.
My xcode disable archive & distribute menu because no successful build to archive.
I resolved it with this idea: build the app on terminal/android studio, then archive & distribute on xcode.
The step is:
uninstall cocoapods
sudo gem uninstall cocoapods
install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
nano ~/.zshrc
export PATH="/opt/homebrew/bin:$PATH"
brew --version
install cocoapods
brew install cocoapods
pod --version
link xcode
flutter doctor
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
go to your flutter project and
flutter clean
flutter pub get
cd ios
pod install
pod update
open Runner.xcworkspace with xcode and set your signing & capabilities
open terminal on your flutter project and build
flutter build ios --release
This will build Runner.app
Go to xcode, on Runner choose any ios device (arm64), to enable archive.
Then
product-> archive->distribute app->next->manual signin->set your certificate distributor
This will build your .ipa

`ReferenceError: Meteor is not defined` in `meteor-client.js` Angular-Meteor Project

After an npm install which triggered meteor-client bundle during postinstall, I am receiving this new error in the browser console:
"ReferenceError: Meteor is not defined
at Object.eval (webpack-internal:///../../../../meteor-client.js:32502:3)
at eval (webpack-internal:///../../../../meteor-client.js:32507:30)
at Object.../../../../meteor-client.js (http://localhost:4200/vendor.bundle.js:1395:1)
at __webpack_require__ (http://localhost:4200/inline.bundle.js:55:30)
at eval (webpack-internal:///../../../../../clients/browser/main.ts:3:72)
at Object.../../../../../clients/browser/main.ts (http://localhost:4200/main.bundle.js:424:1)
at __webpack_require__ (http://localhost:4200/inline.bundle.js:55:30)
at Object.0 (http://localhost:4200/main.bundle.js:439:18)
at __webpack_require__ (http://localhost:4200/inline.bundle.js:55:30)
at webpackJsonpCallback (http://localhost:4200/inline.bundle.js:26:23)"
```
Triggered at:
if (Package.reload) {
Meteor._reload.onMigrate(function () {
return [false];
});
}
This behavior occurs with:
#angular/cli: both 1.6.3 & 1.6.6
meteor-client-bundler: 0.3.0
Meteor: both 1.6.0.1 & 1.6.1
I had the same issue, and downgrade as John mentioned worked for me.
If you are wondering how to downgrade your meteor app follow the instructions bellow that I've taken from how do I install a previous version of meteor JS?
1) Go to your project root folder
2) Run meteor update --release x.y.z
Where x.y.z is the desired version, for example 1.6.0
Might be related to this issue with a normal angular-meteor setup? It seems like the Meteor version 1.6.0.1 is crashing the meteor-angular setup. I was testing both project setups, with and without AngularCLI, and experienced exactly the errors described here and at angular-meteor issues.
However, resetting the project to Meteor 1.6 worked for me in both cases.

Getting ENAMETOOLONG

Getting the following message when trying to build for android
Processing node_modules failed. Error: spawn ENAMETOOLONG
nativescript 2.4 and android 2.4.1 - all updated.
npm version 3.10.8
node 6.9.1
also using SCSS
I googled and looks like it has to do with windows command line limit.

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

Using React-Native run in Xcode counter an error

I get new version of react-native and when I initialize a new project and run it in Xcode I have the error:(react-native 0.9 IOS run error).
Please help me!
TransformError:
/Users/lizi/Desktop/ATFProject/node_modules/react-native/node_modules/react-transform-hmr/node_modules/react-proxy/node_modules/react-deep-force-update/lib/index.js:
[BABEL]
/Users/lizi/Desktop/ATFProject/node_modules/react-native/node_modules/react-transform-hmr/node_modules/react-proxy/node_modules/react-deep-force-update/lib/index.js:
Unknown option:
/Users/lizi/Desktop/ATFProject/node_modules/react-native/node_modules/react-transform-hmr/node_modules/react-proxy/node_modules/react-deep-force-update/.babelrc.stage
It is an error generated when you transpiling with babel. Make sure the Node version is latest. Clear npm cache with $ sudo npm cache clean and start a new project using RN again.

Resources