Angular-cli: Module not found: Error: Can't resolve 'PouchDB'

Angular-cli: Module not found: Error: Can't resolve 'PouchDB'

OS?

Linux (Amazon Linux AMI)

版本。

angular-cli: 1.0.0-beta.22-1
node: 6.6.0
os: linux x64

重复步骤。

我最近安装了 PouchDB:

npm i pouchdb --save
npm i @types/pouchdb --save-dev

我在 typings.d.ts 中添加了这个:

declare module 'PouchDB';

现在我在我的服务中导入 PouchDB:

import * as PouchDB from 'PouchDB';

好吧,我的笔记本电脑 (MacOS Sierra) 一切正常; ng serveng build 没有问题,PouchDB 运行良好。

但是...在我的服务器(Amazon Linux AMI)中不是一回事...

我在尝试执行 ng build:

时遇到下一个错误
ERROR in ./src/app/pictures.service.ts
Module not found: Error: Can't resolve 'PouchDB' in '/home/aral/project/src/app'
 @ ./src/app/pictures.service.ts 11:0-35
 @ ./src/app/app.module.ts
 @ ./src/app/index.ts
 @ ./src/main.ts
 @ multi main

我的 angular-cli 版本和节点版本与我的笔记本电脑相同...

我比较了在笔记本电脑和服务器上执行 tree 命令,两者都有相同的文件。 (除了 node_modules 中的某些子依赖项)。

谢谢!


GitHub 中报告的问题:https://github.com/angular/angular-cli/issues/3698

我在我的笔记本电脑上使用 Mac,这就是为什么我的笔记本电脑没有这个问题的原因:因为 Mac 主文件系统是大小写 不敏感。 Linux 没那么宽容。所以从 PouchDB 导入系统正在寻找一个 node_modules 名称的 PouchDB,但它实际上被命名为 pouchdb(小写)。

检查package.json文件是否包含pounchbd依赖, 如果未包含,则添加此依赖项 "pouchdb": "^7.2.2" and 运行 npm install