joaogarin / angular-electron

Angular2 and Electron starter using webpack
150 stars 53 forks source link

MacOs Sierra "npm run build.dev" failure caused by webpack #46

Closed verdecchia closed 7 years ago

verdecchia commented 7 years ago

I run "npm install" and than "npm run build", but I receive error from webpack task. Thank you, I appreciate your help.

webpack --progress --profile 0% compiling/Users/mverdecchia/Documents/angular2/angular2-electron/node_modules/webpack-target-electron-renderer/node_modules/webpack/lib/ExternalModuleFactoryPlugin.js:37 if(externals === dependency.request) { ^

TypeError: Cannot read property 'request' of undefined at handleExternals (/Users/mverdecchia/Documents/angular2/angular2-electron/node_modules/webpack-target-electron-renderer/node_modules/webpack/lib/ExternalModuleFactoryPlugin.js:37:33) at next (/Users/mverdecchia/Documents/angular2/angular2-electron/node_modules/webpack-target-electron-renderer/node_modules/webpack/lib/ExternalModuleFactoryPlugin.js:46:8) at handleExternals (/Users/mverdecchia/Documents/angular2/angular2-electron/node_modules/webpack-target-electron-renderer/node_modules/webpack/lib/ExternalModuleFactoryPlugin.js:59:7) at ExternalModuleFactoryPlugin. (/Users/mverdecchia/Documents/angular2/angular2-electron/node_modules/webpack-target-electron-renderer/node_modules/webpack/lib/ExternalModuleFactoryPlugin.js:79:5) at /usr/local/lib/node_modules/webpack/lib/NormalModuleFactory.js:207:3 at NormalModuleFactory.applyPluginsAsyncWaterfall (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:196:70) at NormalModuleFactory.create (/usr/local/lib/node_modules/webpack/lib/NormalModuleFactory.js:191:8) at Compilation.process [as _addModuleChain] (/usr/local/lib/node_modules/webpack/lib/Compilation.js:359:16) at Compilation.process [as addEntry] (/usr/local/lib/node_modules/webpack/lib/Compilation.js:435:7) at SingleEntryPlugin. (/usr/local/lib/node_modules/webpack/lib/SingleEntryPlugin.js:22:15) at Compiler.applyPluginsParallel (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:229:14) at Compiler. (/usr/local/lib/node_modules/webpack/lib/Compiler.js:463:8) at Compiler.applyPluginsAsyncSeries (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:131:46) at Compiler.compile (/usr/local/lib/node_modules/webpack/lib/Compiler.js:456:7) at Compiler. (/usr/local/lib/node_modules/webpack/lib/Compiler.js:219:10) at Compiler.readRecords (/usr/local/lib/node_modules/webpack/lib/Compiler.js:367:10) at Compiler. (/usr/local/lib/node_modules/webpack/lib/Compiler.js:216:9) at next (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:138:11) at Compiler. (/usr/local/lib/node_modules/webpack/lib/CachePlugin.js:34:58) at Compiler.applyPluginsAsyncSeries (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:142:13) at Compiler. (/usr/local/lib/node_modules/webpack/lib/Compiler.js:213:8) at next (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:138:11) at Compiler. (/usr/local/lib/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js:23:3) at Compiler.applyPluginsAsyncSeries (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:142:13) at Compiler.run (/usr/local/lib/node_modules/webpack/lib/Compiler.js:210:7) at processOptions (/usr/local/lib/node_modules/webpack/bin/webpack.js:335:12) at Object. (/usr/local/lib/node_modules/webpack/bin/webpack.js:339:1) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32)

joaogarin commented 7 years ago

Hello Can you check this issue, someone had something simillar but they where able to get it working? I cant seem to reproduce this one :/ https://github.com/joaogarin/angular2-electron/issues/38

joaogarin commented 7 years ago

Hello,

Where you able to find something? There is also this issue here in the angular-cli which points to something simillar https://github.com/angular/angular-cli/issues/1922

I just ran a clean

rm -rf node_modules && npm install && npm run build

And I got no errors.

Best regards Joao Garin

nagarsuresh commented 7 years ago

i was facing the same issue and I am very new to webpack+electon etc, i did one change and it got build and can see the app also require('os').platform() is printing darwin in console. all i did was in the webpack.config.json replace the line config.target = webpackTargetElectronRenderer(config); with config.target = 'electron-renderer'; and commented webpackTargetElectronRenderer in the webpack.config.json coz in the https://github.com/chentsulin/webpack-target-electron-renderer its given something like that.
is it ok to do that ?

joaogarin commented 7 years ago

Yes that looks correct looking at https://github.com/chentsulin/webpack-target-electron-renderer#migrate-to-webpack-2-or-webpack-1--11215

If you want to make a pull request for that it would be awesome. If not I will included as soon as I get some time.

Thanks for the info!

nagarsuresh commented 7 years ago

Thanks @joaogarin , I will make a pull request for this.

nagarsuresh commented 7 years ago

@joaogarin i am not able to create remote branch, could you add me as collaborator to the project.

joaogarin commented 7 years ago

You would have to fork the repository, create your own branch in your own repository (not in this one) and then issue a pull request.

You can read more about it here : https://help.github.com/articles/creating-a-pull-request/

nagarsuresh commented 7 years ago

Thanks @joaogarin for pointing in right direction, created a pull request.