Skip to content

Could not find the pub cache. No LOCALAPPDATA environment variable exists. #2175

@lijialin9

Description

@lijialin9

Flutter-Sdk:3.37.0-1.0.pre-314 • channel main
Dart-Sdk:3.10.0-247.0.dev
The project on GitHub:flutter_scene-master\examples\flutter_app
Cmd:flutter run -d windows --enable-impeller -v
Note:Modify according to the first issue in Issues,otherwise, there will be another error message.
Setting up LOCALAPPDATA and PUB_CACHE still results in an error.
Error message prompt:

[ ] To reproduce run:
[ ] E:\FlutterSDK\flutter\bin\cache\dart-sdk\bin\dart
--packages=E:\FlutterProject\flutter-demo01\flutter_scene-master\examples\flutter_app.dart_tool\package_con
fig.json
E:\FlutterProject\flutter-demo01\flutter_scene-master\examples\flutter_app.dart_tool\hooks_runner\example_a
pp\3a3c4b6b38b994297fc01180a6f477e7\hook.dill
--config=E:\FlutterProject\flutter-demo01\flutter_scene-master\examples\flutter_app.dart_tool\hooks_runner
example_app\3a3c4b6b38b994297fc01180a6f477e7\input.json
[ ] stderr:
[ ] Unhandled exception:
[ ] Exception: Failed to run flutter_scene_importer:import command in build hook (exit
code 255):
[ ] STDERR: Could not find the pub cache. No LOCALAPPDATA environment variable exists.
[ ] Consider setting the PUB_CACHE variable manually.

Code:

final importerResult = Process.runSync(
dartExec.toFilePath(),
[
'run',
'--enable-experiment=native-assets',
'flutter_scene_importer:import',
'--input',
inputFilePath,
'--output',
outDir.uri.resolve(outputFileName).toFilePath(),
'--working-directory',
buildInput.packageRoot.toFilePath(),
],
);
if (importerResult.exitCode != 0) {
throw Exception(
'Failed to run flutter_scene_importer:import command in build hook (exit code ${importerResult.exitCode}):\nSTDERR: ${importerResult.stderr}\nSTDOUT: ${importerResult.stdout}');
}

Attempt:
I printed out the parameters which are equivalent to the following command:

dart run --enable-experiment=native-assets flutter_scene_importer:import --input ../assets_src/fcar.glb --output E:\FlutterProject\flutter-demo01\flutter_scene-master\examples\flutter_app\build\models\fcar.model --working-directory E:\FlutterProject\flutter-demo01\flutter_scene-master\examples\flutter_app\

It was successfully executed in CMD.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions