M Maclaren
M Maclaren

Reputation: 3

Flutter Installation: OS Error: Access is denied, errno=5

I tried installing flutter by following the steps at https://flutter.dev/docs/get-started/install , but kept running into the following error when inputting flutter in to Command Prompt:

Unhandled exception: FileSystemException: Cannot open file, path = 'C:\Users\matt\AppData\Roaming.flutter_tool_state' (OS Error: Access is denied. , errno = 5) #0 _File.throwIfError (dart:io/file_impl.dart:645:7) #1 _File.openSync (dart:io/file_impl.dart:489:5) #2 _File.writeAsBytesSync (dart:io/file_impl.dart:614:31) #3 _File.writeAsStringSync (dart:io/file_impl.dart:638:5) #4 ForwardingFile.writeAsStringSync (package:file/src/forwarding/forwarding_file.dart:154:16) #5 ErrorHandlingFile.writeAsStringSync. (package:flutter_tools/src/base/error_handling_file_system.dart:137:22) #6 ErrorHandlingFile._runSync (package:flutter_tools/src/base/error_handling_file_system.dart:163:16) #7 ErrorHandlingFile.writeAsStringSync (package:flutter_tools/src/base/error_handling_file_system.dart:136:5) #8 Config._flushValues (package:flutter_tools/src/base/config.dart:86:11) #9 Config.setValue (package:flutter_tools/src/base/config.dart:75:5) #10 _DefaultPersistentToolState.isRunningOnBot= (package:flutter_tools/src/persistent_tool_state.dart:120:45) #11 BotDetector.isRunningOnBot (package:flutter_tools/src/base/bot_detector.dart:46:33) #12 isRunningOnBot (package:flutter_tools/src/globals.dart:98:48) #13 runInContext.runnerWrapper (package:flutter_tools/src/context_runner.dart:63:34) #14 AppContext.run. (package:flutter_tools/src/base/context.dart:150:29) #15 _rootRun (dart:async/zone.dart:1184:13) #16 _CustomZone.run (dart:async/zone.dart:1077:19) #17 _runZoned (dart:async/zone.dart:1619:10) #18 runZoned (dart:async/zone.dart:1539:10) #19 AppContext.run (package:flutter_tools/src/base/context.dart:149:18) #20 runInContext (package:flutter_tools/src/context_runner.dart:67:24) #21 run (package:flutter_tools/runner.dart:48:10) #22 main (package:flutter_tools/executable.dart:69:9) #23 main (file:///C:/b/s/w/ir/k/archive/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3) #24 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32) #25 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Any help would be appreciated!

Upvotes: 0

Views: 4452

Answers (2)

edalvb
edalvb

Reputation: 724

It worked for me disabling the "Controlled folder access" option in Windows Defender

enter image description here

Upvotes: 0

griffins
griffins

Reputation: 8274

(OS Error: Access is denied. , errno = 5)

Error 5: Access denied is a known issue on Windows 10. This error prevents you from installing software on your computer and accessing or modifying certain files.

The reason for this issue is the non-availability of the permissions. Windows 10 will prevent you from installing if you don’t have the Administrator privileges or if your account is not the administrator account.

How to Fix Error 5 Access Denied?

Upvotes: 0

Related Questions