'pub get'给出了Angular2软件包的错误 [英] 'pub get' gives an error for Angular2 package

查看:50
本文介绍了'pub get'给出了Angular2软件包的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个'pubspec.yaml',其内容如下:

I have a 'pubspec.yaml' with below content:

# #docregion
name: angular2_tour_of_heroes
version: 0.0.1
environment:
  sdk: '>=1.13.0 <2.0.0'
dependencies:
  angular2: 2.0.0-beta.15
  browser: ^0.10.0
  dart_to_js_script_rewriter: ^1.0.1
transformers:
- angular2:
    platform_directives:
    - package:angular2/common.dart#COMMON_DIRECTIVES
    platform_pipes:
     - package:angular2/common.dart#COMMON_PIPES
    entry_points: web/main.dart

在命令行中运行 pub get时,出现以下错误:

When I run 'pub get' in command line, get below error:

Resolving dependencies... 
Got dependencies!
Precompiling dependencies... 
Loading source assets... 
Loading angular2/transform/codegen, dart_to_js_script_rewriter, observe and smokLoading angular2/transform/codegen, dart_to_js_script_rewriter, observe and smokLoading angular2/transform/codegen, dart_to_js_script_rewriter, observe and smoke/src/default_transformer transformers... 
Transformer library "package:angular2/transform/codegen.dart" not found.

如何解决?

创建错误报告: https://github.com/dart-lang/pub/issues/1406

推荐答案

我遇到了同样的问题,花了很多时间来解决它。我的根本原因是在迁移到新计算机之后。我的主机文件未迁移。将 127.0.0.1本地主机添加到主机文件后,它开始工作。

I had the same issue and spent a ton of time trying to fix it. My root cause was after I migrated to a new computer. My hosts file did not migrate. Once I added 127.0.0.1 localhost to my hosts file it started working.

这篇关于'pub get'给出了Angular2软件包的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆