我收到错误消息“ [ts]找不到模块'@ angular / platform-browser / animations'。”
我已经安装了以下内容:
,然后尝试将app.module中的BrowserAnimationsModule导入,如下所示: “从'@ angular / platform-browser / animations'导入{BrowserAnimationsModule};“
这在我的package.json中
"dependencies": {
"@agm/core": "^1.0.0-beta.0",
"@angular/animations": "^7.0.1",
"@angular/cdk": "^7.0.2",
"@angular/common": "^2.4.0",
"@angular/compiler": "^2.4.0",
"@angular/core": "^2.4.0",
"@angular/forms": "^2.4.0",
"@angular/http": "^2.4.0",
"@angular/material": "^7.0.2",
"@angular/platform-browser": "^2.4.0",
"@angular/platform-browser-dynamic": "^2.4.0",
"@angular/router": "^3.4.0",
"animate.css": "^3.5.2",
"arrive": "^2.3.1",
"bootstrap": "^3.3.5",
"bootstrap-notify": "^3.1.3",
"bootstrap-select": "^1.12.2",
"bootstrap-tagsinput": "^0.7.1",
"chartist": "^0.9.4",
"chartist-plugin-zoom": "^0.4.0",
"chartjs-plugin-zoom": "^0.5.0",
"core-js": "^2.4.1",
"datatables": "1.10.12",
"datatables.net-bs": "1.10.12",
"datatables.net-responsive": "^2.1.1",
"domready": "^1.0.8",
"eonasdan-bootstrap-datetimepicker": "4.17.47",
"fullcalendar": "^3.4.0",
"googleapis": "^19.0.0",
"jasny-bootstrap": "^3.1.3",
"jquery": "^1.12.4",
"nouislider": "^9.2.0",
"rxjs": "^5.1.0",
"twitter-bootstrap-wizard": "^1.2.0",
"validate": "^3.0.1",
"web-animations-js": "^2.2.2",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^2.4.0",
"@types/bootstrap": "^3.3.32",
"@types/chartist": "^0.9.34",
"@types/jasmine": "2.5.38",
"@types/jquery": "^1.10.31",
"@types/node": "^6.0.73",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.0.0"
}
您能告诉我如何解决此问题吗?谢谢。
答案 0 :(得分:0)
import csv
# your input file (10GB)
in_csvfile = open('source.csv', "r")
# reader, that would read file for you line-by-line
reader = csv.DictReader(in_csvfile)
# number of current line read
num = 0
# number of output file
output_file_num = 1
# your output file
out_csvfile = open('out_{}.csv'.format(output_file_num), "w")
# writer should be constructed in a read loop,
# because we need csv headers to be already available
# to construct writer object
writer = None
for row in reader:
num += 1
# Here you have your data line in a row variable
# If writer doesn't exists, create one
if writer is None:
writer = csv.DictWriter(
out_csvfile,
fieldnames=row.keys(),
delimiter=",", quotechar='"', escapechar='"',
lineterminator='\n', quoting=csv.QUOTE_NONNUMERIC
)
# Write a row into a writer (out_csvfile, remember?)
writer.writerow(row)
# If we got a 10000 rows read, save current out file
# and create a new one
if num > 10000:
output_file_num += 1
out_csvfile.close()
writer = None
# create new file
out_csvfile = open('out_{}.csv'.format(output_file_num), "w")
# reset counter
num = 0
# Closing the files
in_csvfile.close()
out_csvfile.close()
文件中的@angular
依赖项未对齐。根据您的配置,package.json
是@angular/animations
,而所有其他^7.0.1
库都设置为@angular/*
。
您应该对所有^2.4.0
范围内的软件包使用相同的符号。如果您决定更新,则可能必须将打字稿和其他一些库升级。
@angular
答案 1 :(得分:0)
在我看来,您正在尝试将最新版本的Angular Material与过时的Angular版本结合使用。
我建议您要么坚持使用2.x.x
版本的Angular Material和Angular CDK,要么按照以下步骤操作:
注1:除非明确说明,否则所有命令都应在项目的根目录中运行。
注释#2:请不要在命令中复制注释(即#
符号及其后的文本)。他们在那里解释命令的作用。
通过运行以下命令来重新安装Angular CLI,以安装最新版本:
npm i -g @angular/cli # Globally installs the Angular CLI
npm i @angular/cli # Locally installs the Angular CLI (to your project)
通过运行以下命令将Angular项目文件更新为新的Angular CLI v6 +工作区文件:
ng update @angular/cli
通过运行以下命令来安装最新版本的TypeScript(v3.1.1
):
npm i -D typescript@latest
这对于Angular v7
及更高版本是必需的。
通过运行以下命令将所有Angular依赖项更新为Angular v7 +:
ng update @angular/core
应该(希望如此)!如果您需要任何说明,请随时发表评论!
注意:以上说明是根据官方Angular Update Guide改编的。