Я пытаюсь использовать этот пакет Imgur из NPM в моем веб-приложении Angular. После установки все казалось нормально. Даже после импорта. Однако, после инициализации переменной с помощью пакета, я получаю ошибки компиляции, которые утверждают, что в моем коде есть ошибки разрешения, такие как «crypto».
Версия NPM: 5.6.0
Угловая версия: 6.2.9
Есть идеи, что могло послужить причиной этой проблемы? Есть идеи как это исправить?
Я попытался установить, казалось бы, отсутствующие пакеты, но они все еще рассматривались как отсутствующие, когда я попытался снова скомпилировать.
Я также попытался снизить версию своего узла до более старых версий, но безрезультатно.
Ни один из них не удалил мои node_modules и не переустановил их.
Вот код, который я использую для инициализации модуля в машинописи:
import { Component, OnInit } from '@angular/core';
import * as Convert from 'color-convert';
import * as Hex from 'hex2dec';
import * as ClarifaiSVC from '../clarifai_service/clarifai.service';
import * as Imgur from 'imgur';
@Component({
selector: 'app-imagery',
templateUrl: './imagery.component.html',
styleUrls: ['./imagery.component.css']
})
export class ImageryComponent implements OnInit {
constructor(private Clarifai: ClarifaiSVC.ClarifaiService, private Imgur: Imgur) { }
}
Это то, что написано в журнале npm после подачи:
ERROR in ./node_modules/aws-sign2/index.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\aws-sign2'ERROR in ./node_modules/aws4/aws4.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\aws4'
ERROR in ./node_modules/ecc-jsbn/index.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\ecc-jsbn'
ERROR in ./node_modules/http-signature/lib/verify.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\http-signature\lib'
ERROR in ./node_modules/http-signature/lib/signer.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\http-signature\lib'
ERROR in ./node_modules/oauth-sign/index.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\oauth-sign'
ERROR in ./node_modules/request/lib/oauth.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\request\lib'
ERROR in ./node_modules/request/lib/helpers.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\request\lib'
ERROR in ./node_modules/request/lib/hawk.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\request\lib'
ERROR in ./node_modules/sshpk/lib/identity.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\sshpk\lib'ERROR in ./node_modules/sshpk/lib/utils.js
ERROR in ./node_modules/sshpk/lib/formats/openssh-cert.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\sshpk\lib\formats'
ERROR in ./node_modules/sshpk/lib/formats/ssh-private.js
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\sshpk\lib\formats'
ERROR in ./node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\fs.realpath'
ERROR in ./node_modules/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\request\lib'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'http' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\tunnel-agent'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'https' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\forever-agent'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'https' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\request'
--------------------------------------------
--------------------------------------------
This just goes on for a while
--------------------------------------------
--------------------------------------------
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'stream' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\request'
ERROR in ./node_modules/sshpk/lib/ed-compat.js
Module not found: Error: Can't resolve 'stream' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard\node_modules\sshpk\lib'ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'zlib' in 'C:\Users\Gilian\Documents\School\3EA2_18-19\Internet Of Things\src\dashboard\dashboard