After having ejected webpack.config.js I use to compile my Angular project using the command: npm run build, lately while launched the build I got the following error:
在弹出webpack.config.js后,我使用命令编译我的Angular项目:npm run build,最近在启动构建时出现以下错误:
ERROR in ./node_modules/@angular/http/@angular/http.es5.js
Module not found: Error: Can't resolve 'rxjs/operator/share'
in 'C:\...\node_modules@angular\c ore@angular'
@ ./node_modules/@angular/core/@angular/core.es5.js 9:0-44
@ ./ClientApp/main.ts @ multi ./ClientApp/main.ts
Modules versions are as next:
模块版本如下:
@angular/cli: 1.4.9 (e)
node: 6.11.3
os: win32 x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.9
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
@ngtools/webpack: 1.7.4
typescript: 2.7.0-dev.20171031
and here is the npm-debug log:
这是npm-debug日志:
info it worked if it ends with ok
verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', verbose cli 'run', verbose cli 'build' ]
info using npm@3.10.10
info using node@v6.11.3
verbose run-script [ 'prebuild', 'build', 'postbuild' ]
info lifecycle ng2-asp-core@0.0.0~prebuild: ng2-asp-core@0.0.0
silly lifecycle ng2-asp-core@0.0.0~prebuild: no script for prebuild, continuing
info lifecycle ng2-asp-core@0.0.0~build: ng2-asp-core@0.0.0
verbose lifecycle ng2-asp-core@0.0.0~build: unsafe-perm in lifecycle true
verbose lifecycle ng2-asp-core@0.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;..............etc ......
verbose lifecycle ng2-asp-core@0.0.0~build: CWD: C:\MyApp
silly lifecycle ng2-asp-core@0.0.0~build: Args: [ '/d /s /c', 'webpack' ]
silly lifecycle ng2-asp-core@0.0.0~build: Returned: code: 2 signal: null
info lifecycle ng2-asp-core@0.0.0~build: Failed to exec build script
verbose stack Error: ng2-asp-core@0.0.0 build: `webpack` verbose stack Exit status 2 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16) verbose stack at emitTwo (events.js:106:13) verbose stack at EventEmitter.emit (events.js:191:7) verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14) verbose stack at emitTwo (events.js:106:13) verbose stack at ChildProcess.emit (events.js:191:7) verbose stack at maybeClose (internal/child_process.js:920:16) verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
verbose pkgid ng2-asp-core@0.0.0
verbose cwd C:\MyApp
error Windows_NT 10.0.14393
error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
error node v6.11.3
error npm v3.10.10
error code ELIFECYCLE
error ng2-asp-core@0.0.0 build: `webpack` error Exit status 2
error Failed at the ng2-asp-core@0.0.0 build script 'webpack'.
error Make sure you have the latest version of node.js and npm installed. error If you do, this is most likely a problem with the ng2-asp-core package, error not with npm itself. error Tell the author that this fails on your system: error webpack error You can get information on how to open an issue for this project with: error npm bugs ng2-asp-core error Or if that isn't available, you can get their info via: error npm owner ls ng2-asp-core error There is likely additional logging output above.
verbose exit [ 1, true ]
As the debug log points to ng2-asp-core package as error source, I have run the command npm owner ls ng2-asp-core to get the owner but got a 404 error: ng2-asp-core' is not in the npm registry^
由于调试日志指向ng2-asp-core软件包作为错误源,我运行命令npm owner ls ng2-asp-core来获取所有者,但得到了404错误:ng2-asp-core'不在npm中注册表^
Update: Package.json file:
更新:Package.json文件:
{
"name": "ng2-asp-core",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "webpack-dev-server --port=4200",
"build": "webpack",
"test": "karma start ./karma.conf.js",
"lint": "ng lint",
"e2e": "protractor ./protractor.conf.js",
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.2.4",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"core-js": "^2.4.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14",
"lodash": "^4.17.4"
},
"devDependencies": {
"@angular/cli": "1.4.9",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@ngtools/webpack": "^1.7.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/lodash": "^4.14.66",
"@types/node": "~6.0.60",
"autoprefixer": "^6.5.3",
"circular-dependency-plugin": "^3.0.0",
"codelyzer": "~3.2.0",
"copy-webpack-plugin": "^4.1.1",
"css-loader": "^0.28.1",
"cssnano": "^3.10.0",
"exports-loader": "^0.6.3",
"file-loader": "^1.1.5",
"html-webpack-plugin": "^2.29.0",
"istanbul-instrumenter-loader": "^2.0.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"less-loader": "^4.0.5",
"postcss-loader": "^1.3.3",
"postcss-url": "^5.1.2",
"protractor": "~5.1.2",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.3",
"source-map-loader": "^0.2.0",
"style-loader": "^0.13.1",
"stylus-loader": "^3.0.1",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3",
"url-loader": "^0.6.2",
"webpack": "~3.7.1",
"webpack-concat-plugin": "1.4.0",
"webpack-dev-server": "~2.7.1",
"concurrently": "^3.2.0",
"lite-server": "^2.2.2"
}
}
1 个解决方案
#1
0
It looks to me like you don't have rxjs
installed so you should run npm install rxjs
to fix.
它看起来像你没有安装rxjs所以你应该运行npm install rxjs来修复。
#1
0
It looks to me like you don't have rxjs
installed so you should run npm install rxjs
to fix.
它看起来像你没有安装rxjs所以你应该运行npm install rxjs来修复。