Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProcessException: The system cannot find the file specified during tool/get #60

Closed
D-Elyes opened this issue Mar 30, 2020 · 2 comments · Fixed by #151
Closed

ProcessException: The system cannot find the file specified during tool/get #60

D-Elyes opened this issue Mar 30, 2020 · 2 comments · Fixed by #151

Comments

@D-Elyes
Copy link

D-Elyes commented Mar 30, 2020

Hello, i encounter this error when running flutter pub run tool/get -s 2019c

INFO: 2020-03-30 11:48:40.367549: Creating temp directory
INFO: 2020-03-30 11:48:40.386498: Temp directory created: C:\Users\edoudech\AppData\Local\Temp\1\tzdata-a107c7fb-726b-11ea-97e5-48f17f21bc99
INFO: 2020-03-30 11:48:40.386498: Downloading timezone data
INFO: 2020-03-30 11:48:41.181374: Unpacking timezone data: C:\Users\edoudech\AppData\Local\Temp\1\tzdata-a107c7fb-726b-11ea-97e5-48f17f21bc99\tzdata2019c.tar.gz
INFO: 2020-03-30 11:48:41.360893: Creating zic directory
INFO: 2020-03-30 11:48:41.362886: Compiling timezone data with zic compiler
INFO: 2020-03-30 11:48:41.362886: - africa
CreateProcessW failed 2
INFO: 2020-03-30 11:48:41.368871: Cleaning up temporary directories
Unhandled exception:
ProcessException: The system cannot find the file specified.

Command: zic -d C:\Users\edoudech\AppData\Local\Temp\1\tzdata-a107c7fb-726b-11ea-97e5-48f17f21bc99\zic C:\Users\edoudech\AppData\Local\Temp\1\tzdata-a107c7fb-726b-11ea-97e5
-48f17f21bc99\africa
#0 zic (file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/timezone-0.5.6/tool/get.dart:80:18)

#1 main (file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/timezone-0.5.6/tool/get.dart:122:13)

#2 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32)
#3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
pub finished with exit code 255

@jamesncl
Copy link

jamesncl commented Jun 3, 2020

This is because the tool which builds the timezone database relies on an application called zic, which is not included in Windows. So, as far as I know, this is a Windows only issue.

Here's what I did to work around the issue. On Windows 10, install / fire up Ubuntu on Windows Subsystem for Linux (WSL). Then in the ubuntu shell window:

Install Dart and add to PATH

sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install dart
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile

Close the Ubuntu / WSL window, and open it up again, so the PATH changes are applied.

Clone the timezone repo and run the tool

git clone https://github.com/srawlins/timezone.git
cd timezone
pub run tool/get -s 2020a
  • replace 2020a with the latest version

Copy files to Windows file system

The timezone databases are generated and stored in lib/data in the timezone folder on WSL, so copy them from the WSL filesystem to your flutter project on your Windows file system. I chose to put them in a folder called assets in the root of my project:

mv lib/data/2020a* /mnt/d/code/my-flutter-project/assets/timezone/
  • replace 2020a with whatever version you used earlier
  • there are 3 databases (see here for an explanation) so I'm using wildcard * to copy all three at the same time - you may only want to copy one of them
  • /mnt/d/code/my-flutter-project is the location of my flutter project on my Windows D drive, so change as necessary
  • create an assets folder if it doesn't exist

Include the database as an asset

Add the database asset in pubsepc.yaml:

  assets:
    - assets/timezone/2020a.tzf

Initialise the database

The rest should work as per the instructions for the timezone package. For example, initialise the library:

var byteData = await rootBundle.load('assets/timezone/2020a.tzf');
initializeDatabase(byteData.buffer.asUint8List());

@dJani97
Copy link

dJani97 commented Aug 13, 2021

A link to this guide should be totally added to the documentation.

@srawlins srawlins changed the title ProcessException: The system cannot find the file specified. ProcessException: The system cannot find the file specified during tool/get Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants