Flutter pub get running in wrong directory? - windows

I created a new flutter project using flutter create. The path to pubspec.yaml is D:\dev\flutter\example\
But when I run flutter run in my projects, it gives an error: pubspec.yaml not found in D:\dev\flutter\
Why is flutter pub get running in the parent directory of my project?

I solved it. my bad i didnt look at my pubspec which contained
dependencies:
flutter:
sdk: flutter
responsive_framework:
path: ../
the 'path' was causing it to run pub get in parent directory.

Move to the folder you have recently created-
cd example
Then run "flutter run" from that folder.

Go to your project directory by:
cd D:\dev\flutter\example
Then run:
flutter clean
flutter run

Related

Run `flutter clean` command on each project in a directory

As a Flutter developer, I've been working on many projects. I have to work on all of them occasionally. Now those projects lie in a single directory occupying 30+ GB on my drive. It'd be a good idea to have the project's build-cache deleted to save some space. So I figured to write a script that would loop through each of them and run flutter clean inside every folder instead of running the command manually under each project's root.
After Google and StackOverflow search I came up with a command :
for /D %G in ("D:\MyProjects\*") do flutter clean "%~fG"
Well this command executes the flutter clean command for each folder like:
C:\Users\vipin>flutter clean "D:\MyProjects\Project1"
C:\Users\vipin>flutter clean "D:\MyProjects\Project2"
C:\Users\vipin>flutter clean "D:\MyProjects\Project3"
C:\Users\vipin>flutter clean "D:\MyProjects\Project4"
This should have worked since the command states to run flutter clean for each folder as it looked. Unfortunately, it didn't and threw error:
C:\Users\vipin>flutter clean "D:\MyProjects\Project1"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
C:\Users\vipin>flutter clean "D:\MyProjects\Project2"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
C:\Users\vipin>flutter clean "D:\MyProjects\Project3"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
C:\Users\vipin>flutter clean "D:\MyProjects\Project4"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
...
Well, the pubspec.yaml files are very much present in each folder and I figured that the flutter clean command demands your prompt pointing to Project's ROOT, like below to do the job:
D:\Myprojects\Project1>flutter clean
Now I'm looking for a command/script anything to move the command's prompt to each project's root and execute the command.
Glad you asked. I had the same thought about doing it to my list of projects. The below command will do exactly what you expect. Make sure to run this from D:\MyProjects
for /d %i in (D:\MyProjects\*) do ( cd "%i" & flutter clean )

Makefile cannot find executable - no such file or directory

I have a minimal makefile used in a flutter project:
run-profile:
flutter run -t lib/main_dev.dart --profile
I run
make run-profile and get this error
flutter run -t lib/main_dev.dart --profile
make: flutter: No such file or directory
make: *** [run-profile] Error 1
I can run in same terminal totally fine the command flutter and get normal outputs etc
flutter
Manage your Flutter app development.
Common commands:
flutter create <output directory>
Create a new Flutter project in the specified directory.
flutter run [options]
Run your Flutter application on an attached de
I even modified /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Users/me/flutter/bin
and stil makefile cannot find flutter bin, or i have some syntax error in makefile.
I am on macos big sur 11.4
You could add it in PATH variable, the path where flutter is present before so that it will always consider this path while searching first.The step can be done inside your makefile also in below way:
export PATH := /Users/kristi.jorgji/flutter/bin/flutter: $(PATH)
run-profile:
flutter run -t lib/main_dev.dart --profile
Note : Ensure you have flutter executable present in the path that you mentioned
/Users/kristi.jorgji/flutter/bin/flutter
If flutter executable is present in bin directory of your mentioned path, then you need to give path till /Users/kristi.jorgji/flutter/bin

How to fix 'ReactCommon/CallInvoker.h file not found' after manual upgrade from v0.61.5 to v0.63.3

I had to manually upgrade react-native, because nix react-native upgrade failed.
After following the Upgrade Helper for v.0.61.5 -> v0.63.3, ive cleaned my build folder and tried to run the application, only to get a failed build
the error is:
Lexical or Preprocessor Issue: 'ReactCommon/CallInvoker.h' file not
found ->
NativeToJsBridge.h
why is this happening? comment for additional environment/file information
Go to the ios/ directory in your project.
Delete Podfile.lock and Pods/ directory, then run pod install --repo-update.

React Native how to change iOS bundle identifier?

I tried to change the bundle identifier in the Info.plist and the xcode itself. (in full empty project).
But for some reason I can't build it. Entry, ":CFBundleIdentifier", Does Not Exist. And what strange is that I can build it successfully in the xcode but not with the npm run ios. Any idea how to solve this?
Try the react-native-rename npm package.
npm install react-native-rename -g
On the root of your React Native project execute the following command
react-native-rename "ExampleApp" -b com.newname.newid
Check the docs > react-native-rename

'React/RCTViewManager.h' file not found

Here I'm using xcodebuild shell command to build a release version in my react native project, it comes a fatal error:
'React/RCTViewManager.h' file not found
#import <React/RCTViewManager.h>
Xcode version: 8.3
react native version: 0.44.0
Any help ?
This solved the problem for me
Clear node_module folder and package-lock.json rm -rf node_modules && rm package-lock.json
Clean Xcode's Build folder menu product>clean build folder
Reinstall dependencies and link npm install && react-native link
replace the #import <React/RCTViewManager.h> by #import "RCTViewManager.h"
Hope it helps you
i solved this issue in easy ways
uninstall react-native-linear gradient
cd ios && pod install
after uninstalling completely go to xcode.workspace =>product=>clean build
run-ios
after successfully running
npm install react-native-linear-gradient
then cd ios && pod install
you must see autolinking for react-native-linear gradient
It will work properly
Note = Don't do manually linking if your react native version > 0.60

Resources