0

Dart 一直工作到我更新了编辑器,现在我得到了现有和新项目的错误。我尝试完全重新安装 Dart。当我在 web-ui 上为新项目运行 pub install 时收到以下消息:

--- Jun 11, 2013 10:25:11 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.

, errno = 2)
#0      _File.throwIfError (file_impl.dart:444:7)
#1      _File.openSync (file_impl.dart:310:17)
#2      _File.readAsBytesSync (file_impl.dart:363:26)
#3      _File.readAsStringSync (file_impl.dart:381:41)
#4      readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5      _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6      version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7      main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)

正确安装时该目录中没有“版本”文件。我添加了该文件并收到以下消息:

--- Jun 11, 2013 10:23:42 PM Running pub install ... ---

Pub install failed, [69] Resolving dependencies...

Failed NSS_Init call.

当我创建一个新项目时,我得到以下信息:

--- Jun 11, 2013 10:26:17 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/MyApp/build.dart
build.dart returned error code 255

Do not know how to load 'dart:uri''package:analyzer_experimental/src/generated/java_core.dart': Error: line 4 pos 1: library handler failed
import "dart:uri";
^
'package:analyzer_experimental/src/generated/ast.dart': Error: line 7 pos 1: library handler failed
import 'java_core.dart';
^
'package:web_ui/src/compiler.dart': Error: line 10 pos 1: library handler failed
import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, UriBasedDirective;
^
'package:web_ui/dwc.dart': Error: line 12 pos 1: library handler failed
import 'src/compiler.dart';
^
'package:web_ui/component_build.dart': Error: line 25 pos 1: library handler failed
import 'dwc.dart' as dwc;
^
'file:///C:/Users/Phloxicon/Dropbox/dart/MyApp/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^


--- Jun 11, 2013 10:26:18 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.

, errno = 2)
#0      _File.throwIfError (file_impl.dart:444:7)
#1      _File.openSync (file_impl.dart:310:17)
#2      _File.readAsBytesSync (file_impl.dart:363:26)
#3      _File.readAsStringSync (file_impl.dart:381:41)
#4      readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5      _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6      version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7      main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)


--- Jun 11, 2013 10:26:18 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/Test02/build.dart
build.dart returned error code 255

Unable to open file: C:/Users/Phloxicon/Dropbox/dart/Test02/packages/web_ui/component_build.dart'file:///C:/Users/Phloxicon/Dropbox/dart/Test02/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^


--- Jun 11, 2013 10:26:18 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/quiz_generator/build.dart
build.dart returned error code 255

Do not know how to load 'dart:uri''package:analyzer_experimental/src/generated/java_core.dart': Error: line 4 pos 1: library handler failed
import "dart:uri";
^
'package:analyzer_experimental/src/generated/ast.dart': Error: line 7 pos 1: library handler failed
import 'java_core.dart';
^
'package:web_ui/src/compiler.dart': Error: line 10 pos 1: library handler failed
import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, UriBasedDirective;
^
'package:web_ui/dwc.dart': Error: line 12 pos 1: library handler failed
import 'src/compiler.dart';
^
'package:web_ui/component_build.dart': Error: line 25 pos 1: library handler failed
import 'dwc.dart' as dwc;
^
'file:///C:/Users/Phloxicon/Dropbox/dart/quiz_generator/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^


--- Jun 11, 2013 10:26:19 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.

, errno = 2)
#0      _File.throwIfError (file_impl.dart:444:7)
#1      _File.openSync (file_impl.dart:310:17)
#2      _File.readAsBytesSync (file_impl.dart:363:26)
#3      _File.readAsStringSync (file_impl.dart:381:41)
#4      readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5      _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6      version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7      main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)


--- Jun 11, 2013 10:26:19 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/sdgdsfg/build.dart
build.dart returned error code 255

Unable to open file: C:/Users/Phloxicon/Dropbox/dart/sdgdsfg/packages/web_ui/component_build.dart'file:///C:/Users/Phloxicon/Dropbox/dart/sdgdsfg/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^


--- Jun 11, 2013 10:26:19 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.

, errno = 2)
#0      _File.throwIfError (file_impl.dart:444:7)
#1      _File.openSync (file_impl.dart:310:17)
#2      _File.readAsBytesSync (file_impl.dart:363:26)
#3      _File.readAsStringSync (file_impl.dart:381:41)
#4      readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5      _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6      version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7      main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)


--- Jun 11, 2013 10:26:19 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/srtgdsfg/build.dart
build.dart returned error code 255

Unable to open file: C:/Users/Phloxicon/Dropbox/dart/srtgdsfg/packages/web_ui/component_build.dart'file:///C:/Users/Phloxicon/Dropbox/dart/srtgdsfg/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^


--- Jun 11, 2013 10:26:19 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/test1/build.dart
build.dart returned error code 255

Do not know how to load 'dart:uri''package:analyzer_experimental/src/generated/java_core.dart': Error: line 4 pos 1: library handler failed
import "dart:uri";
^
'package:analyzer_experimental/src/generated/ast.dart': Error: line 7 pos 1: library handler failed
import 'java_core.dart';
^
'package:web_ui/src/compiler.dart': Error: line 10 pos 1: library handler failed
import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, UriBasedDirective;
^
'package:web_ui/dwc.dart': Error: line 12 pos 1: library handler failed
import 'src/compiler.dart';
^
'package:web_ui/component_build.dart': Error: line 26 pos 1: library handler failed
import 'dwc.dart' as dwc;
^
'file:///C:/Users/Phloxicon/Dropbox/dart/test1/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^


--- Jun 11, 2013 10:26:20 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.

, errno = 2)
#0      _File.throwIfError (file_impl.dart:444:7)
#1      _File.openSync (file_impl.dart:310:17)
#2      _File.readAsBytesSync (file_impl.dart:363:26)
#3      _File.readAsStringSync (file_impl.dart:381:41)
#4      readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5      _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6      version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7      main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)


--- Jun 11, 2013 10:26:20 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/testest/build.dart
build.dart returned error code 255

Unable to open file: C:/Users/Phloxicon/Dropbox/dart/testest/packages/web_ui/component_build.dart'file:///C:/Users/Phloxicon/Dropbox/dart/testest/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^


--- Jun 11, 2013 10:26:20 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.

, errno = 2)
#0      _File.throwIfError (file_impl.dart:444:7)
#1      _File.openSync (file_impl.dart:310:17)
#2      _File.readAsBytesSync (file_impl.dart:363:26)
#3      _File.readAsStringSync (file_impl.dart:381:41)
#4      readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5      _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6      version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7      main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)

有任何想法吗?

4

2 回答 2

1
Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version'

这看起来你的 Dart 安装坏了。当您安装 Dart SDK 时,该文件绝对应该存在,而 pub 没有它就无法工作。

您是自己构建 SDK,还是只是下载预构建的 SDK?

于 2013-10-07T18:34:46.737 回答
0

尽量pub update不要pub install更新缓存的包。

然后Reanalyze Sources从同一个工具菜单中使用。请务必在运行之前清除所有日志,Reanalyze Sources以便确保它进行了干净的构建。

如果这不能让您完全清理干净,请删除packages您在项目树中看到的所有out目录,以及可能存在的所有目录以及pubspec.lock文件。然后运行pub install

这通常让我回到干净的构建。

于 2013-06-12T13:10:54.413 回答