[英]Using yarn to add a package in angular2
I am still new to yarn and angular2 so excuse any naivety in this question. 我对yarn和angular2还是很陌生,所以请原谅这个问题。
I am trying to use yarn to add nvd3 to my project so I ran yarn add @types/nvd3 --save-dev
and then added import { nv } from 'nvd3'
in the main module.ts
but that isn't compiling with the error Module '"C:/xampp/htdocs/omitted/omitted/node_modules/@types/nvd3/index"' has no exported member 'nv'.
我正在尝试使用yarn将nvd3添加到我的项目中,所以我运行了
yarn add @types/nvd3 --save-dev
,然后在主module.ts
添加了import { nv } from 'nvd3'
与错误Module '"C:/xampp/htdocs/omitted/omitted/node_modules/@types/nvd3/index"' has no exported member 'nv'.
However, in nodemodules/@types/nvd3/index.d.ts
there is a export = nv;
但是,在
nodemodules/@types/nvd3/index.d.ts
有一个export = nv;
. 。
Any ideas what I am doing wrong? 有什么想法我做错了吗?
You need to actually install the library, with 您需要使用以下命令实际安装该库
npm install nvd3 --save npm install nvd3-保存
You only installed the "types" for it, you need both. 您仅为其安装了“类型”,而这两者都需要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.