我从GitLab克隆了项目,并做了npm install
,
s下载了所有依赖项,没有任何问题,但是当我执行npm start
时失败了,没有模块工厂可用于依赖项类型:ContextElementDependency此错误。
我在本地使用的是6.9.2版的节点。
错误:
18% building modules 70/104 modules 34 active ...node_modules\querystring-es3\index.jsError: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:206:21)
at Compilation.processModuleDependencies (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:195:8)
at _this.buildModule.err (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:335:13)
at building.forEach.cb (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:140:27)
at Array.forEach (native)
at callback (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:140:13)
at module.build (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:167:11)
at ContextModule.<anonymous> (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\ContextModule.js:118:3)
at ContextModule.result.resolveDependencies (C:\Users\3643585\Desktop\ecamv2\node_modules\@ngtools\webpack\src\plugin.js:224:25)
at ContextModule.build (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\ContextModule.js:99:7)
at Compilation.buildModule (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:142:10)
at factoryCallback (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:324:11)
at C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\ContextModuleFactory.js:96:12
at C:\Users\3643585\Desktop\ecamv2\node_modules\tapable\lib\Tapable.js:268:11
at done.then (C:\Users\3643585\Desktop\ecamv2\node_modules\@ngtools\webpack\src\plugin.js:226:28)
18% building modules 70/105 modules 35 active ...ode_modules\webpack\buildin\global.jsC:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:264
if(_this.profile) {
^
TypeError: Cannot read property 'profile' of null
at factoryCallback (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:264:13)
at C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\NormalModuleFactory.js:242:4
at C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\NormalModuleFactory.js:93:13
at C:\Users\3643585\Desktop\ecamv2\node_modules\tapable\lib\Tapable.js:268:11
at NormalModuleFactory.params.normalModuleFactory.plugin (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\CompatibilityPlugin.js:52:5)
at NormalModuleFactory.applyPluginsAsyncWaterfall (C:\Users\3643585\Desktop\ecamv2\node_modules\tapable\lib\Tapable.js:272:13)
at onDoneResolving (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\NormalModuleFactory.js:68:11)
at onDoneResolving (C:\Users\3643585\Desktop\ecamv2\node_modules\@angular\cli\node_modules\webpack\lib\NormalModuleFactory.js:189:6)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fxo-ecam@0.0.2 start: `ng serve --proxy ./dev-proxies/local.proxy.conf.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fxo-ecam@0.0.2 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\3643585\AppData\Roaming\npm-cache\_logs\2018-12-06T22_57_26_745Z-debug.log
下面是我的package.json文件
Package.json:
{
"name": "fxo-ecam",
"version": "0.0.2",
"license": "MIT",
"scripts": {
"ng": "ng",
"serve-dev": "ng serve --environment=dev",
"serve-release": "ng serve --environment=release",
"serve-uat": "ng serve --environment=uat",
"serve-staging": "ng serve --environment=staging",
"start": "ng serve --proxy ./dev-proxies/local.proxy.conf.json",
"startpcf": "ng serve --proxy ./dev-proxies/pcf.proxy.conf.json",
"dev-build": "ng build --environment=dev --target=development",
"release-build": "ng build --environment=release --target=development",
"uat-build": "ng build --environment=uat --target=development",
"staging-build": "ng build --environment=staging --target=development",
"debug-build": "ng build --environment=prod --target=development --bh /ecam/components/fxo/",
"build": "ng build --environment=prod --target=production --aot=false --bh /ecam/components/fxo/",
"test": "ng test --code-coverage",
"tt": "ng test --browsers=Chrome --watch",
"lint": "ng lint",
"e2e": "ng e2e",
"compodoc": "./node_modules/.bin/compodoc -p ./tsconfig.json"
},
"private": true,
"dependencies": {
"@angular/animations": "4.3.4",
"@angular/common": "4.3.4",
"@angular/compiler": "4.3.4",
"@angular/core": "4.3.4",
"@angular/forms": "4.3.4",
"@angular/http": "4.3.4",
"@angular/platform-browser": "4.3.4",
"@angular/platform-browser-dynamic": "4.3.4",
"@angular/platform-server": "4.3.4",
"@angular/router": "4.3.4",
"@types/xlsx": "0.0.36",
"ajv": "^5.0.0",
"alasql": "^0.3.9",
"core-js": "2.4.1",
"font-awesome": "4.6.3",
"intl": "^1.2.5",
"jquery": "3.1.0",
"ng2-progressbar": "^1.3.0",
"pdfmake": "^0.1.38",
"primeng": "4.0.3",
"rxjs": "5.1.0",
"ts-xlsx": "0.0.11",
"web-animations-js": "^2.2.5",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular-devkit/core": "0.0.29",
"@angular/cli": "1.0.0-rc.0",
"@angular/compiler-cli": "4.3.4",
"@compodoc/compodoc": "^1.0.0-beta.12",
"@types/jasmine": "2.5.45",
"@types/node": "^6.0.91",
"codelyzer": "^3.0.0",
"jasmine-core": "^2.5.2",
"jasmine-spec-reporter": "^3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-firefox-launcher": "^1.0.1",
"karma-ie-launcher": "^1.0.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.4",
"karma-spec-reporter": "0.0.31",
"node-sass": "^4.9.1",
"phantomjs-prebuilt": "^2.1.14",
"protractor": "5.1.2",
"protractor-beautiful-reporter": "^1.2.7",
"ts-node": "^2.1.2",
"tslint": "^5.0.0",
"typescript": "2.1.5"
}
}
答案 0 :(得分:2)
这可能是因为webpack版本。
我遇到了同样的错误,我删除了node_modules文件夹和package-lock.json文件,并再次安装了npm。这些步骤解决了我的问题。
1. rm -r node_modules
2. rm package-lock.json
3. npm i
干杯!