代码之家  ›  专栏  ›  技术社区  ›  Nikul Panchal

获取错误:未能找到模块“react bootstrap modal”的声明文件。反应JS

  •  3
  • Nikul Panchal  · 技术社区  · 7 年前

    我是ReactJS的新用户,我已经安装了 npm install react-bootstrap-modal 当我用它的时候 var Modal = require('react-bootstrap-modal') ,下面是我的错误,有人能帮我做些什么吗?

    Could not find a declaration file for module 'react-bootstrap-modal'. 'd:/wamp64/www/my-app/node_modules/react-bootstrap-modal/lib/Modal.js' implicitly has an 'any' type.Try `npm install @types/react-bootstrap-modal` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-bootstrap-modal';` [7016]
    
    Try `npm install @types/react-bootstrap-modal` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-bootstrap-modal';` [7016]
    
    1 回复  |  直到 7 年前
        1
  •  6
  •   Rishabh    7 年前

    没有为React引导模式安装范围类型定义 尝试安装它们:

    npm install --save-dev @types/node 
    npm install --save @types/react-bootstrap
    

    包的类型化版本由definitelytyped维护, 开源社区。(对于typescript 2.0+) https://github.com/DefinitelyTyped/DefinitelyTyped