dart_frog icon indicating copy to clipboard operation
dart_frog copied to clipboard

fix: exception when running dart_frog build

Open Mahfa opened this issue 3 years ago • 5 comments

Description

I just created a project with cli and then changed nothing. when i wanted to build the project the cli would give this exception

āœ“ Bundling sources (0.1s)
An exception occurred while executing hook: pre_gen.dart.
Error: FileSystemException: Rename failed, path = 'C:\Users\madi\AppData\Local\Temp\943e167a' (OS Error: The system cannot move the file to a different disk drive.
, errno = 17)

Steps To Reproduce

  1. create a project with dart_frog create
  2. run dart_frog build

Expected Behavior

project should been build for production

Additional Context Dart SDK version: 2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "windows_x64"

Mahfa avatar Jul 21 '22 20:07 Mahfa

Hi @Mahfa šŸ‘‹ Thanks for opening an issue!

Can you please provide the exact version of windows you're running on? Thanks!

felangel avatar Jul 21 '22 21:07 felangel

hi @felangel ur welcome this is my windows version

Edition	Windows 10 Pro
Version	21H2
Installed on	ā€Ž2/ā€Ž27/ā€Ž2022
OS build	19044.1766
Experience	Windows Feature Experience Pack 120.2212.4180.0

I fixed the issue with dart_frog build by moving my project to drive C but there is another issue when running dart_frog dev

C:\Users\madi\Documents\projects\tests\my_first_frog>dart_frog dev
āœ“ Running on http://localhost:8080 (3.7s)
The Dart VM service is listening on http://127.0.0.1:8181/7XjAwm6iFgE=/

The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/7XjAwm6iFgE=/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A8181%2F7XjAwm6iFgE%3D%2Fws

.dart_frog/server.dart:7:8: Error: Error when reading '.dart_frog/..%0Doutesindex.dart': The filename, directory name, or volume label syntax is incorrect.

import '..\routes\index.dart' as index;
       ^
.dart_frog/server.dart:29:22: Error: Undefined name 'onRequest'.
    ..all('/', index.onRequest);
                     ^^^^^^^^^

Mahfa avatar Jul 22 '22 14:07 Mahfa

hi @felangel ur welcome this is my windows version

Edition	Windows 10 Pro
Version	21H2
Installed on	ā€Ž2/ā€Ž27/ā€Ž2022
OS build	19044.1766
Experience	Windows Feature Experience Pack 120.2212.4180.0

I fixed the issue with dart_frog build by moving my project to drive C but there is another issue when running dart_frog dev

C:\Users\madi\Documents\projects\tests\my_first_frog>dart_frog dev
āœ“ Running on http://localhost:8080 (3.7s)
The Dart VM service is listening on http://127.0.0.1:8181/7XjAwm6iFgE=/

The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/7XjAwm6iFgE=/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A8181%2F7XjAwm6iFgE%3D%2Fws

.dart_frog/server.dart:7:8: Error: Error when reading '.dart_frog/..%0Doutesindex.dart': The filename, directory name, or volume label syntax is incorrect.

import '..\routes\index.dart' as index;
       ^
.dart_frog/server.dart:29:22: Error: Undefined name 'onRequest'.
    ..all('/', index.onRequest);
                     ^^^^^^^^^

Hi @Mahfa have you tried updating to the latest version of dart_frog_cli?

dart pub global activate dart_frog_cli

This should be resolved on v0.0.2-dev.9. Let me know if that helps šŸ‘

felangel avatar Jul 22 '22 15:07 felangel

hey @felangel thanks for the update. the new version did solve the problem with dart_frog dev but the project still won't build if it is not located in drive C

Mahfa avatar Jul 22 '22 15:07 Mahfa

hey @felangel thanks for the update. the new version did solve the problem with dart_frog dev but the project still won't build if it is not located in drive C

Awesome, yeah we'll plan to address the drive location issue in the next sprint šŸ‘

felangel avatar Jul 22 '22 15:07 felangel

I also get this error, while running a dart_frog build from within Google cloud shell.

Dart SDK version: 2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "linux_x64"
$HOME/.pub-cache/bin/dart_frog build
āœ“ Bundling sources (0.1s)
An exception occurred while executing hook: pre_gen.dart.
Error: FileSystemException: Rename failed, path = '/tmp/JMWDTL' (OS Error: Invalid cross-device link, errno = 18)

The directory is there... and seems to be a copy of the root folder of my project, without the build folder.

james@cloudshell:~/budvue_api (api2-clickspace-tv)$ ls -l /tmp/JMWDTL/
total 44
-rw-r--r-- 1 james james   139 Aug 17 02:24 analysis_options.yaml
-rw-r--r-- 1 james james  1577 Aug 17 02:24 deployment.yaml
drwxr-xr-x 6 james james  4096 Aug 17 02:24 lib
-rw-r--r-- 1 james james 13604 Aug 17 02:24 pubspec.lock
-rw-r--r-- 1 james james   335 Aug 17 02:24 pubspec.yaml
-rw-r--r-- 1 james james  1745 Aug 17 02:24 README.md
drwxr-xr-x 3 james james  4096 Aug 17 02:24 routes
drwxr-xr-x 3 james james  4096 Aug 17 02:24 test

Any pointers on having me chip in on this?

hotdang-ca avatar Aug 17 '22 03:08 hotdang-ca

@hotdang-ca planning to look more closely at this very soon. In the meantime, are you able to do the build locally and deploy the artifacts to google cloud as outlined in our docs?

felangel avatar Aug 17 '22 14:08 felangel

I cannot on a Mac M1 host -- causes unrelated docker issues with the executable. I could try on an Intel Mac host; cannot do the build on a Windows host, for the same original reason:

āœ“ Bundling sources (1.5s)
An exception occurred while executing hook: pre_gen.dart.
Error: FileSystemException: Rename failed, path = '/tmp/QJSAAC' (OS Error: Invalid cross-device link, errno = 18)
dart_frog --version
0.1.0

THAT's actually inside of a Ubuntu 20.04 box through Windows Subsystem for Linux. I'll try right now from straight windows.

I took a look at the source code... you do Directory.rename(...), it could be related to a dart version.

dart --version
Dart SDK version: 2.17.6 (stable) (Tue Jul 12 12:54:37 2022 +0200) on "linux_x64"

I'll play around some more and figure something out.

I need the image in the Artifact Registry for GKE to pick it up. The project we are working on are part of a kubernetes cluster. maybe I'm using this for more than what it was designed. I've been in the dart + google world for 3+ years, but our reliance on firebase-interop and dart2js is impacting the creation of new projects. So, dart_frog is our new platform which we are slowly migrating over legacy (pre-sound null safe) code.

hotdang-ca avatar Aug 17 '22 19:08 hotdang-ca

Windows is fine:

flutter --version
Flutter 3.0.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f1875d570e (5 weeks ago) • 2022-07-13 11:24:16 -0700
Engine • revision e85ea0e79c
Tools • Dart 2.17.6 • DevTools 2.12.2
dart_frog --version
0.1.0

Just those linux hosts (including WSL) it seems.

hotdang-ca avatar Aug 17 '22 19:08 hotdang-ca

@hotdang-ca thanks for providing the additional context. I’m planning to spend some time on this tomorrow and will provide an update shortly.

felangel avatar Aug 17 '22 23:08 felangel