admin管理员组

文章数量:814879

得到错误:找不到模块'mg

当我尝试导入模块时,我遇到错误Could not find a declaration file for module 'mg-api-js',我试图以这种方式安装它npm install @types/mg-api-js,但它也无法正常工作,任何人都可以帮助我解决此问题吗?

const GeotabApi  = require('mg-api-js');
const authentication = {
    credentials: {
        database: '**',
        userName: '****',
        password: '****'
    }
}
const api = new GeotabApi(authentication);
回答如下:

1)删除您的node_modules目录,然后:npm install --save mg-api-js

2)检查您的node_modules/mg-api-js/dist目录并确保api.min.js存在。

3)如果不存在,则可以从https://github/Geotab/mg-api-js复制源代码并手动粘贴到此node_modules/mg-api-js目录中。

4)请安装最新版本'2.0.1'

5)看到此问题,可能会对您有所帮助:https://github/Geotab/mg-api-js/issues/3

我将这个模块安装在Windows上并为我工作。

本文标签: 得到错误找不到模块39mg