我有angular2 Nativescript项目,我已经实现了延迟加载 . 我现在正在尝试使用AOT按照nativescript给出的指示实现webpack - 这里 . 因此,我安装了插件:nativescript-dev-webpack和 .

现在当我运行时,npm运行start-android-bundle,我收到以下错误:

`ERROR in Could not resolve module @angular/core

ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'C:\Users\krithika\MyProjects\questNewS\app'
@ ./main.aot.ts 3:0-60
Child extract-text-webpack-plugin C:\Users\krithika\MyProjects\questNewS\node_modules\extract-text-webpack-plugin\dist C:\Users\krithika\MyProjects\questNewS\node_modules\resolve-url-loader\index.js??ref--1-1!C:\Users\krithika\MyProjects\questNewS\node_modules\nativescript-css-loader\index.js??ref--1-2!C:\Users\krithika\MyProjects\questNewS\node_modules\nativescript-dev-webpack\platform-css-loader.js!C:\Users\krithika\MyProjects\questNewS\app\app.css:
[1] ../node_modules/resolve-url-loader?{"silent":true,"absolute":false,"sourceMap":false,"fail":false,"keepQuery":false,"debug":false,"root":null,"includeRoot":false}!../node_modules/nativescript-css-loader?{"minimize":false}!../node_modules/nativescript-dev-webpack/platform-css-loader.js!./app.css 925 bytes {0} [built]
+ 2 hidden modules
Webpack Bundle Analyzer saved stats file to C:\Users\krithika\MyProjects\questNewS\report\stats.json
Webpack Bundle Analyzer saved report to C:\Users\krithika\MyProjects\questNewS\report\report.html
child process exited with code 2

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\krithika\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "ns-bundle" "--android" "--build-app"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ ns-bundle: ns-bundle
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ ns-bundle script 'ns-bundle'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ns-bundle
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\krithika\MyProjects\questNewS\npm-debug.log

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\krithika\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "build-android-bundle"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ build-android-bundle: npm run ns-bundle --android --build-app
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build-android-bundle script 'npm run ns-bundle --android --build-app'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run ns-bundle --android --build-app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\krithika\MyProjects\questNewS\npm-debug.log`

此外,在我的代码中,我发现ts文件给出了一个错误,说“无法找到模块@ angular / core” . “ui / page”和“rxjs / Rx”发生类似错误

我已经做了以下事情来解决这个问题但没有成功 -

  • 删除了node_modules,hooks和platform并再次添加它们
    如上所述

  • 将"enhanced-resolve"更改为3.3.0 here

  • 将模板和样式引用更改为相对路径请提示我可以尝试的内容,以便我可以让webpack在我的项目中工作 .