我有一個使用webpack的角度4項目。 我的package.json
包括ngx-mqtt
作爲devDependency。據我所知,所有的依賴關係應該是webpack的devDependencies。Webpack依賴性處理(無法解析'..')
這導致了一個錯誤,mqtt.js
包含一個我用shebang-loader修復的意外#令牌。
現在我收到的錯誤:
Module not found : error : Can't resolve 'mqtt'
我加入MQTT固定這個我package.json
(我不認爲我會到,因爲它是ngx-mqtt
依賴)
這樣做的結果是:
Module not found : error : Can't resolve 'utf-8-validate' which is a dependency of websocket-stream which in turn is a dependency of mqtt
這不可能吧?我不必自己聲明我的庫依賴關係。
package.json
:
"devDependencies": {
"@angular/animations": "4.2.5",
"@angular/common": "4.2.5",
"@angular/compiler": "4.2.5",
"@angular/compiler-cli": "4.2.5",
"@angular/core": "4.2.5",
"@angular/forms": "4.2.5",
"@angular/http": "4.2.5",
"@angular/platform-browser": "4.2.5",
"@angular/platform-browser-dynamic": "4.2.5",
"@angular/platform-server": "4.2.5",
"@angular/router": "4.2.5",
"@ngtools/webpack": "1.5.0",
"@types/chai": "4.0.1",
"@types/jasmine": "2.5.53",
"@types/text-encoding": "0.0.32",
"@types/webpack-env": "1.13.0",
"@types/node": "^8.0.34",
"angular2-router-loader": "^0.3.5",
"angular2-template-loader": "0.6.2",
"aspnet-prerendering": "^3.0.1",
"aspnet-webpack": "^2.0.1",
"awesome-typescript-loader": "^3.2.3",
"bootstrap": "3.3.7",
"chai": "4.0.2",
"css": "2.2.1",
"css-loader": "0.28.4",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.11",
"expose-loader": "^0.7.3",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "^0.11.2",
"html-loader": "^0.4.5",
"isomorphic-fetch": "2.2.1",
"jasmine-core": "2.6.4",
"jquery": "3.2.1",
"json-loader": "^0.5.7",
"jw-bootstrap-switch-ng2": "^1.0.4",
"karma": "1.7.0",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-webpack": "2.0.3",
"ngx-mqtt": "1.15.0",
"preboot": "4.5.2",
"raw-loader": "^0.5.1",
"reflect-metadata": "0.1.10",
"rxjs": "5.4.2",
"shebang-loader": "^0.0.1",
"style-loader": "^0.18.2",
"text-encoding": "0.6.4",
"to-string-loader": "^1.1.5",
"typescript": "^2.5.3",
"url-loader": "^0.5.9",
"webpack": "^2.7.0",
"webpack-hot-middleware": "^2.19.1",
"webpack-merge": "4.1.0",
"zone.js": "0.8.12"
}
您是否使用npm install安裝了所有依賴項? –
我已經運行npm install多次了嗎? – Qowy
你可以用package.json更新你的文章嗎? –