./node_modules/elasticsearch/src/lib/utils.js中的错误找不到模块:错误:无法解析\ node_modules \ elasticsearch \ src \ lib'中的'path'

时间:2018-05-04 23:39:02

标签: node.js elasticsearch angular5 angular6

我试图将我的角度5代码迁移到角度6。

将elasticsearch客户端从“elasticsearch”:“^ 14.2.1”迁移到“elasticsearch”:“^ 14.2.2”后,我得到以下错误,同时启动角度代码。

npm start

ERROR in ./node_modules/elasticsearch/src/lib/utils.js
Module not found: Error: Can't resolve 'path' in 
'\ui_angular_6\node_modules\elasticsearch\src\lib'
: Failed to compile.

的package.json

"dependencies": {
"@angular/animations": "6.0.0",
"@angular/common": "6.0.0",
"@angular/compiler": "6.0.0",
"@angular/core": "6.0.0",
"@angular/flex-layout": "^5.0.0-beta.14",
"@angular/forms": "6.0.0",
"@angular/http": "6.0.0",
"@angular/platform-browser": "6.0.0",
"@angular/platform-browser-dynamic": "6.0.0",
"@angular/router": "6.0.0",
"@ng-bootstrap/ng-bootstrap": "^1.1.2",
"angular-datatables": "^5.0.0",
"angular-font-awesome": "^3.1.2",
"body-parser": "^1.18.2",
"bootstrap": "^4.1.0",
"core-js": "^2.4.1",
"elasticsearch": "^14.2.2",
"express": "^4.16.3",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"ng2-pdf-viewer": "^4.1.2",
"popper.js": "^1.14.3",
"rxjs": "^6.1.0",
"rxjs-compat": "^6.1.0",
"underscore": "^1.8.3",
"zone.js": "^0.8.26"
},
 "devDependencies": {
"@angular/cli": "6.0.0",
"@angular/compiler-cli": "6.0.0",
"@angular/language-service": "6.0.0",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/jquery": "^3.3.1",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "^2.7.2",
"@angular-devkit/build-angular": "~0.6.0"

}

请帮我解决这个问题。

2 个答案:

答案 0 :(得分:0)

将Elastic search Client更新到15.1.1解决了我的问题

"elasticsearch": "^15.1.1",

答案 1 :(得分:0)

使用下面的此行安装require依赖项

npm i --save util events lodash url querystring http https agentkeepalive zlib