找不到模块'pouchdb',可在Mac上使用,但在Windows上无法使用

时间:2019-01-07 09:17:52

标签: javascript angular ionic-framework ionic3

我要接管一个在我的队友Mac上工作的离子项目。使用ionic / cordova / python清洁Windows 10 PC。该项目运行,但是发生以下错误。我尝试了多种不同的方式将pouchdb包含在项目中(使用@ types /使用较旧的版本,使用require而不是导入,删除和重新安装节点模块等),但找不到此错误的任何方法。我已还原所做的所有更改。以下代码适用于我的队友Mac。

我也刚刚和他核对过版本。我正在运行所有相同版本的node / python / ionic等。

error

package.json

{
    "name": "camara2",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "5.0.0",
        "@angular/compiler": "5.0.0",
        "@angular/compiler-cli": "5.0.0",
        "@angular/core": "5.0.0",
        "@angular/forms": "5.0.0",
        "@angular/http": "5.0.0",
        "@angular/platform-browser": "5.0.0",
        "@angular/platform-browser-dynamic": "5.0.0",
        "@ionic-native/camera": "^4.11.0",
        "@ionic-native/core": "4.3.2",
        "@ionic-native/splash-screen": "4.3.2",
        "@ionic-native/status-bar": "4.3.2",
        "@ionic/storage": "2.1.3",
        "@types/pouchdb": "6.3.2",
        "ajv": "^6.0.0",
        "cordova-android": "^6.2.3",
        "cordova-browser": "^4.1.0",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-console": "^1.1.0",
        "cordova-plugin-device": "^1.1.7",
        "cordova-plugin-splashscreen": "^4.1.0",
        "cordova-plugin-statusbar": "^2.4.2",
        "cordova-plugin-whitelist": "^1.3.3",
        "cropperjs": "^1.4.1",
        "ionic": "^4.6.0",
        "ionic-angular": "3.9.2",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "json-circular-stringify": "0.0.1",
        "mrz": "^3.1.0",
        "newtondev-mrz-parser": "^1.1.0",
        "rxjs": "5.5.2",
        "sw-toolbox": "3.6.0",
        "tesseract.js": "^1.0.10",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@ionic/app-scripts": "3.2.1",
        "@ionic/lab": "1.0.6",
        "typescript": "2.4.2"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-camera": {},
            "cordova-plugin-console": {}
        },
        "platforms": [
            "android",
            "browser",
            "ios"
        ]
    }
}

导入

//import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Http, Headers, HttpModule } from '@angular/http';
import PouchDB from 'pouchdb';
import 'rxjs/add/operator/map';

1 个答案:

答案 0 :(得分:1)

您必须使用以下方式安装PouchDB

npm install --save pouchdb

@types/pouchdb不是实际的模块。这只是打字稿的类型,您需要两个模块。