Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect path file reference to packages when sharing solution between mac and windows

I have solution/flutter app running on windows fine. Within the .packages file vscode is referencing the package via

analyzer:file:///c:/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.31.2-alpha.2/lib/
args:file:///c:/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.4.3/lib/
async:file:///c:/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.7/lib/
...

I have the flutter sdk installed c:\flutter directory on windows.

I copied this solution via dropbox to the mac and when running

"Warning! This package referenced a Flutter repository via the .packages file that is no longer available".

In an effort to isolate/locate the problem, I created a new Flutter project on the mac and found that the .packages file referenced packages via

analyzer:file:///flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.31.2-alpha.2/lib/
args:file:///flutter/.pub-cache/hosted/pub.dartlang.org/args-1.4.3/lib/
async:file:///flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.7/lib/
...

Notice the different paths used on both systems.

I suspect I can search/replace the references file:///c:/flutter to file:///flutter and it should work but I would like to avoid always manually swapping out locations. Is there an easier approach when sharing solutions across mac and windows?

thx

like image 480
David Avatar asked May 29 '18 16:05

David


People also ask

How do I fix path too long error?

If you see this error there are several solutions: 1) Instead of right clicking on the file to extract it, left click on the file to enter the zip directly. Then look for long folder names and make them shorter. Then close the zip file and extract it again.

How do you fix Cannot open the file because the file path is more than 259 characters?

Workaround 1: Reduce the character count Rename the file so that it has a shorter name. Rename one or more folders that contain the file so that they have shorter names. Move the file to a folder that has a shorter path name.

How do I resolve a reference problem in Visual Studio?

To fix a broken project reference by correcting the reference path. In Solution Explorer, right-click your project node, and then select Properties. The Project Designer appears. If you're using Visual Basic, select the References page, and then click the Reference Paths button.


2 Answers

Don't copy .packages over from one machine to another. (It should be in .gitignore if using git.)

Instead, run flutter packages get on the mac, and it will recreate .packages.

(Don't copy .flutter-plugins either.)

like image 73
Richard Heap Avatar answered Nov 09 '22 06:11

Richard Heap


Just remove .packages file. It will do the trick. Or you can clear the .packages file.

like image 7
Blasanka Avatar answered Nov 09 '22 07:11

Blasanka