Problems running webpack


#1

Hello,

i’m having troubles when I run npm run start-android-bundle.

i’m trying with a newly created project with tns create test2 --ng and after install webpack and run the code above this is the output …

C:\nativescript\test2>npm run start-android-bundle

> @ prestart-android-bundle C:\nativescript\test2
> npm run webpack-android


> @ prewebpack-android C:\nativescript\test2
> npm run clean-android


> @ clean-android C:\nativescript\test2
> tns clean-app android


> @ webpack-android C:\nativescript\test2
> webpack --config=webpack.android.js --progress

keywords if/then/else require v5 option
C:\nativescript\test2\node_modules\nativescript-dev-webpack\resource-resolver-plugins\StyleUrlResolvePlugin.js:25
        let maybeAotPlugin = compilation._ngToolsWebpackPluginInstance;
        ^^^

		
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\nativescript\test2\node_modules\nativescript-dev-webpack\index.js:15:37)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\adan_\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "webpack-android"
npm ERR! node v4.2.6
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ webpack-android: `webpack --config=webpack.android.js --progress`
npm ERR! Exit status 1
npm ERR!	
npm ERR! Failed at the @ webpack-android script 'webpack --config=webpack.android.js --progress'.
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!     webpack --config=webpack.android.js --progress
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:\nativescript\test2\npm-debug.log

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\adan_\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "start-android-bundle"
npm ERR! node v4.2.6
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ prestart-android-bundle: `npm run webpack-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ prestart-android-bundle script 'npm run webpack-android'.
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 webpack-android
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:\nativescript\test2\npm-debug.log

Someone who can give me a track ??


#2

I can only assume that you are using an old Node.js distribution where ES6 syntax wasn’t the standard. Update to node LTS and give it another try!

https://nodejs.org/en/


#4

I still have the an error with angular/weppack and newly created project with tns create test --ng

PS C:\nativescript\test> npm run start-android-bundle

> @ prestart-android-bundle C:\nativescript\test
> npm run webpack-android


> @ prewebpack-android C:\nativescript\test
> npm run clean-android


> @ clean-android C:\nativescript\test
> tns clean-app android


> @ webpack-android C:\nativescript\test
> webpack --config=webpack.android.js --progress

Hash: f34c00ccd8aa3b564549
Version: webpack 2.2.0
Time: 16811ms
       Asset       Size  Chunks                    Chunk Names
   bundle.js    47.6 kB       0  [emitted]         bundle
  app.css.js  268 bytes       1  [emitted]         app.css
   vendor.js    3.28 MB       2  [emitted]  [big]  vendor
     app.css    13.4 kB       1  [emitted]         app.css
package.json    1.44 kB          [emitted]
  starter.js   41 bytes          [emitted]
   [0] ../~/@angular/core/index.js 2.5 kB {2} [built]
  [40] ../~/@angular/router/index.js 909 bytes {2} [built]
 [112] ../~/@angular/platform-browser/index.js 635 bytes {2} [built]
 [113] ../~/reflect-metadata/Reflect.js 48.2 kB {2} [built]
 [114] ../~/nativescript-angular/platform-static.js 787 bytes {2} [built]
 [288] ../~/@angular/http/index.js 734 bytes {2} [built]
 [289] ../~/nativescript-angular/forms.js 1.56 kB {2} [built]
 [290] ../~/nativescript-angular/router.js 2.73 kB {2} [built]
 [291] ./app.module.ngfactory.ts 13.4 kB {0} [built]
 [292] ./vendor-platform.android.ts 1.08 kB {2} [built]
 [457] ./app.css 41 bytes {1} [built]
 [458] ./main.aot.ts 244 bytes {0} [built]
 [459] ./vendor.ts 405 bytes {2} [built]
 [460] ../~/nativescript-css-loader!../~/nativescript-theme-core/css/core.light.android.css 13 kB [built]
 [461] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB [built]
    + 447 hidden modules

WARNING in ./app.css
  resolve-url-loader cannot operate: CSS error
  C:\nativescript\test\app\app.css:6:426: property missing ':'
  at error (C:\nativescript\test\node_modules\css\lib\parse\index.js:62:15)

ERROR in compiler_1.StaticSymbolResolver is not a constructor
Child app\app.component.html:
       [0] ./app.component.html 309 bytes {0} [built]
Child extract-text-webpack-plugin:
       [0] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB {0} [built]
       [1] ../~/nativescript-css-loader!../~/nativescript-theme-core/css/core.light.android.css 13 kB {0} [built]
       [2] ../~/resolve-url-loader!../~/nativescript-css-loader!../~/nativescript-dev-webpack/platform-css-loader.js!./app.css 911 bytes {0} [built] [1 warning]

    WARNING in ../~/resolve-url-loader!../~/nativescript-css-loader!../~/nativescript-dev-webpack/platform-css-loader.js!./app.css
      resolve-url-loader cannot operate: CSS error
      C:\nativescript\test\app\app.css:6:426: property missing ':'
      at error (C:\nativescript\test\node_modules\css\lib\parse\index.js:62:15)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\adan_\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "webpack-android"
npm ERR! node v6.9.4
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @ webpack-android: `webpack --config=webpack.android.js --progress`

someone could help me?


#5

I’m afraid I can’t help you. I’m experiencing the same problems currently. I do feel that this should work out of the box (as it does with Angular2 itself). When starting with {N} you have to learn a lot and webpack isn’t the most interest of them.