Export flutter PATH makes docker cli and/or npm not working - docker

I have the following problem.
I noticed that, once i installed flutter and added its path to my .zshrc file, like this
export PATH={$PATH}:/Users/matteo/Documents/flutter/bin
I have problems with docker and/or npm. (E.G. I get the error docker: command not found)
I tried moving my line of code in different places in my .zshrc file, and it seems like depending on where my line of code is placed, sometimes only docker is not found, sometimes only npm, sometimes both of them.
Are there any connection, maybe under the hood, between those 3 application?
My computer is a Macbook Pro with Big Sur 11.4 and M1 chip.
Thanks for help,
Matteo.

you are exporting the path the wrong way, you should add it as follows:
export PATH="$PATH:/Users/matteo/Documents/flutter/bin"
After you have updated the ".zshrc" file, run this command to ensure changes have been notified to OS
source ~/.zshrc
Reference: https://flutter.dev/docs/get-started/install/macos

Related

"zsh: command not found: expo" despite it being installed

I recently bought MacBook Pro (13-inch, 2020 i5) and downloaded expo globally, now the problem which i am facing is it keeps saying expo command not found despite it being installed.
I have tried various soultions such as:
https://forums.expo.io/t/expo-cli-looks-installed-but-expo-command-not-found/14535
(NOTE: The newer version of macOS does not have .bash_profile anymore and has .zprofile instead)
https://www.youtube.com/watch?v=gkqsLRDnqlA
But none of the solution works.
However, to check if it actually works, I cloned one of my projects from work and just changed the script from package.json and runned it from NPM SCRIPT and it does fire up (so it's just the command line that shows command not found and doesn't allow me to init the project and none of the solutions works from the google somehow.

Dot cannot be run in Pycharm with Sphinx and Graphviz

I am trying to create a class diagram with sphinx. For this I created a virtual environment in Pycharm and added this to conf.py:
extensions = ['sphinx.ext.autodoc','sphinx.ext.inheritance_diagram']
In my spamfilter.rst file I added the following lines:
Diagrams
=================
.. inheritance-diagram:: spamfilter
The output is not a diagram and looks like this.
The following warning is displayed:
WARNING: dot command 'dot' cannot be run (needed for graphviz output), check the graphviz_dot setting
When I look into the folder C:\Users\Name\PycharmProjects\documentation\venv\Lib\site-packages\graphviz, there is a dot.py file, so I do not understand what is wrong. A similar question for Mac OS has been asked here. I tried the solution but it seems like it only works for Mac, because when I paste export PATH=$PATH:~/opt/bin to the Pycharm Terminal, it tells me that the command export could not be found. Honestly I have problems understanding why sometimes you can just use packages and other times they cannot be found even when they are installed, I am self-taught and a beginner.
The "pip install graphviz" command installs a Python package that provides an interface to Graphviz (https://pypi.org/project/graphviz). This package is not required by Sphinx.
In order to create inheritance diagrams with Sphinx, the actual Graphviz toolkit (including dot.exe) must be installed. See https://www.graphviz.org.
If dot.exe is not in the PATH, you can use the graphviz_dot configuration option.
I had the same problem where rendering a C4 model with PlantUML didn't work in the IDE (PyCharm 2022.2.1 Pro) on a newer M1 MacOS Monterey. I had it working on a Big Sur intel Mac prior to the upgrade with no extra effort, so the chip change caused me to go down a lot of paths with Rosetta and so on that were all unsuccessful.
The error was:
Dot Executable: /opt/local/bin/dot
File does not exist
Cannot find Graphviz.
Graphviz was installed correctly, and dot was on my path, but it wasn't in /opt/local/bin/dot. Since it was in /opt/homebrew/bin/dot, all I needed to do was link the actual file with the path it was searching for:
cd /opt
sudo ln -s homebrew local
et voilĂ , PyCharm is now correctly rendering the puml in the IDE.

Flutter run command error : FlutterView.send called on a detached view

Can anyone tell me why my app is not installing at all and ending with the error message
Observatory connection never became ready.
the app was working perfectly fine until yesterday .
I have changed the channel to master yesterday in the command prompt and from then on the app never runs.
I even switched back to channel alpha but still no use.
I have attached a screenshot of the command prompt where the installation was stuck forever.
I am not so sure if I need to reinstall the flutter. I am worried if I uninstall the flutter now it may not configure properly and I might break it forever.
Please can someone tell me what exactly might have gone wrong.
Many Thanks,
Mahi
Instead of reinstall try with following: (Mac)
Set Path Variable: via following terminal command
export PATH=~/flutter/bin:$PATH;
that is bin folder path of flutter.
export PATH=[PATH_TO_FLUTTER_GIT_FOLDER]/bin:$PATH
https://flutter.io/setup-macos/#update-your-path
If above not worked. Check with the Dart version
dart --version
Install the latest dart version:
brew install dart --devel
Hope this helps others.
For Mac
open terminal
$ echo $PATH
it will show like this
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
it means you need to add flutter in to path
Open Finder presss command + shift + G
Put /etc/paths in dialog and press GO
Copy the file "paths" and paste it on desktop
Then open the pasted "paths" file from desktop
and add following line into end of the file "/flutter/bin"
Then copy that file and again paste it on /etc/paths
same like step no 2
it will ask you to replace or not
press replace
Now if you hit $ echo $PATH on terminal it will show
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/swagat/development/flutter/bin
Now your $flutter doctor will work perfectly
The solution is from Google Groups #Flutter-Dev
Thank you very much for your reply #Michael Thomsen.
I've tried what you have suggested and the details are as follows:
When I used flutter run -v command the command prompt output is as follows:
It was stuck for a while at waiting for port connection if I am not wrong.
So I've used AndroidStudio, File>Open and selected android/ folder to run the app then the gradle was showing an error:
Error:Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (25.2.0) and test app (25.4.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
I modified the build.gradle(Module:app) to show the correct version of 25.2.0 which was previously showing 25.4.0.
dependencies {
androidTestCompile 'com.android.support:support-annotations:25.2.0'
}
I just saved the changes inside android studio and the gradle sync completed without any errors.
Now I can run the app from inside Android Studio and also from IntelliJ IDE.
Thanks very much Michael this solved my problem.
Reinstalling flutter would be my starting point. If this problem persists, please post the output of $>flutter doctor and a description of what exactly leads to this error.

Setup of React Native using ndenv on OS X

I'm running into PATH difficulty setting up a new React Native iOS project in Xcode 7.1. I'm trying to use ndenv to manage node versions, which means ~/.ndenv/shims needs to be on PATH. To that end, I have PATH set as a user-defined project setting as $PATH:~/.ndenv/shims. The Xcode settings UI shows the correct expanded PATH value.
Yet the project, generated by react-native init, still fails to build. The custom build script fails to find react-native:
../node_modules/react-native/packager/react-native-xcode.sh: line 36: react-native: command not found
react-native is installed correctly, but the environment variables dump in the build output makes clear that ~/.ndenv/shims isn't on PATH. My PATH settings don't appear in the build environment. However, if I set a random user-defined setting (e.g. FOOBAR=baz), that does correctly show up in the build environment.
That result plus further inspection of PATH in the build environment makes clear that Xcode is overriding PATH somewhere along the line.
So in order of preference:
How do I correctly append to PATH for a custom build script in Xcode 7?
Alternatively, what's the best (least hacky?) way of getting ndenv-managed npm modules on PATH for the build script?
Modifying react-native-xcode.sh is out of the question, since that's a part of the external react-native npm module.
UPDATE 1
As a temporary workaround, I've bailed on ndenv and installed node via homebrew. This puts react-native on the (apparently-hardcoded) Xcode path at /usr/local/bin, and works to get the build running. I'm not going to submit or accept this as a solution, since it doesn't allow the repeatable control of node versions that ndenv does.
The problem seems to be that the react-native-xcode.sh script depends on the react-native-cli package to be in PATH. This issue was reported to the project in these two issues on Github:
https://github.com/facebook/react-native/issues/3974
https://github.com/facebook/react-native/issues/3948
I expect a fix to be implemented quite soon, because this is a major problem for anyone using the react-native cli to create new projects.
There are a few work arounds for this problem, but none of them are perfect. Which one would work for you depends on your node / npm setup:
I myself installed node via nvm and just needed to add export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.shbefore running the react-native-xcode.sh.
For this to work you need to have react-native-cli installed globally.
If you need help finding a solution for your specific setup, please give me some more information about your node setup. ( or you can try one of the other solutions pointed out in the issues I linked above. )
Had the same issue. The work around called out in the link below is working for me. Haven't found a permanent solution.
The XCode $PATH differs from terminal $PATH and it doesn't include path of nvm nodes (~/.nvm/versions/...). This can be temporarily fixed by adding source ~/.bash_profile to the beginig of react-native-xcode.sh
https://github.com/facebook/react-native/issues/3948
This issue was effectively fixed when facebook/react-native#5518 landed. react-native-xcode.sh now respects a NODE_BINARY environment variable that tells it where to find node on the build system. Under your app's target, see Build Phases > Bundle React Native code and images and set the shell script code to:
export NODE_BINARY=$HOME/.ndenv/shims/node
../node_modules/react-native/packager/react-native-xcode.sh
If your node is in a different location, change the value of NODE_BINARY to suit your installation. Here's a screencap from Xcode 7.1 to aid navigation:
It looks like a fix for this was just published as release 0.14.2
https://github.com/facebook/react-native/releases/tag/v0.14.2

Pub does not download dependencies on Windows 7 after the update to lib v2 (SDK 0.3.1_r17328)

After the update to the version 0.3.1_r17328 of Dart SDK and Dart Editor I have some trouble to import some library particulary Args library. I have the same problem both directly importing Args or importing Web_ui where Args is one of the dependencies.
Here is my pubspec.yaml:
name: notes
description: A sample application
dependencies:
web_ui: 0.3.0+1
or:
name: notes
description: A sample application
dependencies:
args: 0.3.1+1
Here is the error generate from build.dart
Unable to open file: C:/Users/Fabio/Dropbox/progetti/note/packages/args/args.dart'package:web_ui/component_build.dart': Error: line 25 pos 1: library handler failed
import 'package:args/args.dart';
'file:///C:/Users/Fabio/Dropbox/progetti/note/build.dart': Error: line 1 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
I solved the problem. It seems that the Cache folder (Pub) has been corrupted.
I have deleted the folder Cache: C:\Users\<UserName>\AppData\Roaming\Pub
Then i run pub install from command line and it works.
Unfortunately, I was getting the same error with my windows XP machine.
In the end, I logged into my windows 7 machine and was able to
download the packages, zipped them up and pasted the libraries into my
windows XP dart editor. Success!
I had no reason to believe I had the exact proxy issue #shindokaku had as I am using my home computer.
I tried all the suggestions on deleting the .cache files, pub.lock files and the packages folder and retrying. I uninstalled dart editor and tried again. I also tried using the git resources to download web-ui and running commands through the command line to no avail
Including suggestions in this similar questions:
cannot-find-referenced-source-packages
is-there-a-workaround-for-pub-dependency-resolution-through-proxies
This problem has been haunting me over and over for a few weeks. I am not using Windows, so this answer is not intended to help the original poster who is using Windows 7.
If you are using Linux here are the steps I use to repair corrupted pub cache.
Go to the top level directory of your app. You should see at least pubspec.lock, pubspec.yaml, a folder named packages, and a folder named web.
Delete your pubspec.lock, and packages folder.
[Make sure you aren't storing your own libraries in the packages folder]
cd ~/dart/myApp/
rm -r packages
rm pubspec.lock
Now once you have removed these files:
pub cache repair
Note 1: if your dart-sdk is not in your systems $PATH, than you will want to use the absolute path to the sdk when using the above command. Comment if you need that explained.
Note 2: This is working solution with Dart 1.5.3. I have not tested this on earlier versions.
Try deleting your pubspec.lock file and packages directory in the root folder of the project. Then run pub install again, when things get wacky thats what I do.
You should try to run pub update. I have sometimes found that this doesn't work as expected from the editor, but generally works quite smoothly when called from the command line.

Resources