NativeScript / nativescript-dev-webpack

A package to help with webpacking NativeScript apps.
Apache License 2.0
97 stars 49 forks source link

Error is: Executing webpack failed with exit code 1 #438

Closed anaszgh closed 6 years ago

anaszgh commented 6 years ago

As the documentation guided me i followed the below steps

npm install --save-dev nativescript-dev-webpack npm i

and then

tns run android --bundle the result was the following log, and resulted with failure

Platform Windows 10


Executing before-liveSync hook from C:\Tutor\Tutor.Mobile.User\hooks\before-liveSync\nativescript-angular-sync.js
Executing before-prepare hook from C:\Tutor\Tutor.Mobile.User\hooks\before-prepare\nativescript-dev-typescript.js
Preparing project...
Executing before-prepareJSApp hook from C:\Tutor\Tutor.Mobile.User\hooks\before-prepareJSApp\nativescript-dev-webpack.js
Running webpack for Android...

C:\Tutor\Tutor.Mobile.User\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:88
        const config = ngtools_api_1.readConfiguration(this._tsConfigPath);
                                     ^
TypeError: ngtools_api_1.readConfiguration is not a function
    at NativeScriptAngularCompilerPlugin._setupOptions (C:\Tutor\Tutor.Mobile.User\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:88:38)
    at new AngularCompilerPlugin (C:\Tutor\Tutor.Mobile.User\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:43:14)
    at new NativeScriptAngularCompilerPlugin (C:\Tutor\Tutor.Mobile.User\node_modules\nativescript-dev-webpack\plugins\NativeScriptAngularCompilerPlugin.ts:36:9)
    at module.exports.env (C:\Tutor\Tutor.Mobile.User\webpack.config.js:115:13)
    at handleFunction (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\lib\prepareOptions.js:26:13)
    at prepareOptions (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\lib\prepareOptions.js:11:13)
    at requireConfig (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\convert-argv.js:98:14)
    at C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\convert-argv.js:104:17
    at Array.forEach (<anonymous>)
    at module.exports (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\convert-argv.js:102:15)
    at yargs.parse (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\webpack.js:171:41)
    at Object.Yargs.self.parse (C:\Tutor\Tutor.Mobile.User\node_modules\yargs\yargs.js:533:18)
    at Object.<anonymous> (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\webpack.js:152:7)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
**Unable to apply changes on device: 7EX7N17316006568. Error is: Executing webpack failed with exit code 1..**
Executing after-watch hook from C:\Tutor\Tutor.Mobile.User\hooks\after-watch\nativescript-dev-typescript.js```
NickIliev commented 6 years ago

@anaszgh make sure all Angular and Webpack related dependencies are updated - the error indicates taht you are using incompatible @angular/compiler version.

The latest versions of nativescript-angular and nativescript-dev-webpack are coming with update scripts taht can do the job for you.

npm install --save nativescript-angular@latest
./node_modules/.bin/update-app-ng-deps
npm install --save-dev nativescript-dev-webpack@latest
./node_modules/.bin/update-ns-webpack --configs --deps
npm install --save-dev nativescript-dev-typescript@latest

The instructions are described in details here

anaszgh commented 6 years ago

@NickIliev I ran the three commands you mentioned, but still tns run android --bundle resulted with the same error, here is the command output

tns run android --bundle
Searching for devices...
Executing before-liveSync hook from C:\Tutor\Tutor.Mobile.User\hooks\before-liveSync\nativescript-angular-sync.js
Executing before-prepare hook from C:\Tutor\Tutor.Mobile.User\hooks\before-prepare\nativescript-dev-typescript.js
Hook skipped because either bundling or livesync is in progress.
Preparing project...
Executing before-prepareJSApp hook from C:\Tutor\Tutor.Mobile.User\hooks\before-prepareJSApp\nativescript-dev-webpack.js
Running webpack for Android...

C:\Tutor\Tutor.Mobile.User\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:88
        const config = ngtools_api_1.readConfiguration(this._tsConfigPath);
                                     ^
TypeError: ngtools_api_1.readConfiguration is not a function
    at NativeScriptAngularCompilerPlugin._setupOptions (C:\Tutor\Tutor.Mobile.User\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:88:38)
    at new AngularCompilerPlugin (C:\Tutor\Tutor.Mobile.User\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:43:14)
    at new NativeScriptAngularCompilerPlugin (C:\Tutor\Tutor.Mobile.User\node_modules\nativescript-dev-webpack\plugins\NativeScriptAngularCompilerPlugin.ts:36:9)
    at module.exports.env (C:\Tutor\Tutor.Mobile.User\webpack.config.js:115:13)
    at handleFunction (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\lib\prepareOptions.js:26:13)
    at prepareOptions (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\lib\prepareOptions.js:11:13)
    at requireConfig (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\convert-argv.js:98:14)
    at C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\convert-argv.js:104:17
    at Array.forEach (<anonymous>)
    at module.exports (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\convert-argv.js:102:15)
    at yargs.parse (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\webpack.js:171:41)
    at Object.Yargs.self.parse (C:\Tutor\Tutor.Mobile.User\node_modules\yargs\yargs.js:533:18)
    at Object.<anonymous> (C:\Tutor\Tutor.Mobile.User\node_modules\webpack\bin\webpack.js:152:7)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
Unable to apply changes on device: 7EX7N17316006568. Error is: Executing webpack failed with exit code 1..
Executing after-watch hook from C:\Tutor\Tutor.Mobile.User\hooks\after-watch\nativescript-dev-typescript.js
NickIliev commented 6 years ago

@anaszgh can you post the content of your package.json

If you can provide an archive I would try to investigate the issue locally - you can found me in the community slack channel (username: niliev)

anaszgh commented 6 years ago

@NickIliev unfortunately i cant upload an archive, here is the content of package.jso

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.com.com",
    "tns-ios": {
      "version": "3.2.0"
    },
    "tns-android": {
      "version": "3.4.1"
    }
  },
  "dependencies": {
    "@angular/animations": "~4.4.1",
    "@angular/common": "~4.4.1",
    "@angular/compiler": "~4.4.1",
    "@angular/core": "~4.4.1",
    "@angular/forms": "~4.4.1",
    "@angular/http": "~4.4.1",
    "@angular/platform-browser": "~4.4.1",
    "@angular/router": "~4.4.1",
    "angular2-jwt": "^0.2.3",
    "nativescript-angular": "^5.2.0",
    "nativescript-geolocation": "^4.2.0",
    "nativescript-loading-indicator": "^2.4.0",
    "nativescript-pro-ui": "^3.2.0",
    "nativescript-secure-storage": "^2.2.1",
    "nativescript-snackbar": "^2.0.0",
    "nativescript-theme-core": "~1.0.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.4.2",
    "tns-core-modules": "^3.4.0",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~4.4.1",
    "@ngtools/webpack": "~1.9.1",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "copy-webpack-plugin": "~4.3.0",
    "css-loader": "~0.28.7",
    "extract-text-webpack-plugin": "~3.0.2",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "^0.6.0",
    "nativescript-dev-webpack": "^0.9.2",
    "nativescript-worker-loader": "~0.8.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.2.1",
    "typescript": "~2.4.2",
    "uglifyjs-webpack-plugin": "~1.1.6",
    "webpack": "~3.10.0",
    "webpack-bundle-analyzer": "^2.9.1",
    "webpack-sources": "~1.1.0"
  },
  "author": "Anas Aref"
}
NickIliev commented 6 years ago

@anaszgh it seems that you are using incompatible versions of nativescript-angular and @angular related dependencies. To sync all nativescript-angular and nativescript-dev-webpack related dependencies to compatible versions use the following workflow:

npm install nativescript-angular  --save 
./node_modules/.bin/update-app-ng-deps
npm install nativescript-dev-webpack  --save-dev 
./node_modules/.bin/update-ns-webpack --configs --deps
npm i

The above commands will install the latest versions of all related dependencies. After the installation is done please rebuild your project. Full guide can be found here

MuhammadTahir92 commented 6 years ago

i have got the same error D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:88 const config = ngtools_api_1.readConfiguration(this._tsConfigPath); ^ TypeError: ngtools_api_1.readConfiguration is not a function at NativeScriptAngularCompilerPlugin._setupOptions (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:88:38) at new AngularCompilerPlugin (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:43:14) at new NativeScriptAngularCompilerPlugin (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\nativescript-dev-webpack\plugins\NativeScriptAngularCompilerPlugin.ts:36:9) at module.exports.env (D:\projects\troutBird\production-mobile-app\mobile-app\webpack.config.js:115:13) at handleFunction (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\webpack\lib\prepareOptions.js:26:13) at prepareOptions (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\webpack\lib\prepareOptions.js:11:13) at requireConfig (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\webpack\bin\convert-argv.js:98:14) at D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\webpack\bin\convert-argv.js:104:17 at Array.forEach (<anonymous>) at module.exports (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\webpack\bin\convert-argv.js:102:15) at yargs.parse (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\webpack\bin\webpack.js:171:41) at Object.Yargs.self.parse (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\yargs\yargs.js:533:18) at Object.<anonymous> (D:\projects\troutBird\production-mobile-app\mobile-app\node_modules\webpack\bin\webpack.js:152:7) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) Unable to apply changes on device: emulator-5554. Error is: Executing webpack failed with exit code 1.. Executing after-watch hook from D:\projects\troutBird\production-mobile-app\mobile-app\hooks\after-watch\nativescript-dev-typescript.js my package.json is

{
  "name": "tradelive",
  "version": "1.0.0",
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.tradelivemobile",
    "tns-android": {
      "version": "3.4.0"
    }
  },
  "scripts": {
    "tslint": "tslint -p tsconfig.json"
  },
  "dependencies": {
    "@angular/animations": "~4.4.1",
    "@angular/common": "~4.4.1",
    "@angular/compiler": "~4.4.1",
    "@angular/core": "~4.4.1",
    "@angular/forms": "~4.4.1",
    "@angular/http": "~4.4.1",
    "@angular/platform-browser": "~4.4.1",
    "@angular/router": "~4.4.1",
    "@types/lodash": "^4.14.91",
    "@wwwalkerrun/nativescript-ngx-magic": "^2.0.4",
    "angular2-jwt": "^0.2.3",
    "js-data": "^3.0.1",
    "js-data-http": "^3.0.0",
    "lodash": "^4.17.4",
    "nativescript-angular": "^5.0.0",
    "nativescript-badge-button": "^0.1.2",
    "nativescript-barcodescanner": "^2.7.3",
    "nativescript-bottombar": "^3.0.7",
    "nativescript-checkbox": "^3.0.3",
    "nativescript-exit": "^1.0.1",
    "nativescript-feedback": "^1.1.0",
    "nativescript-floatingactionbutton": "^4.1.3",
    "nativescript-loading-indicator": "^2.4.0",
    "nativescript-localstorage": "^1.1.5",
    "nativescript-material-icons": "^1.0.3",
    "nativescript-ng-shadow": "^2.1.0",
    "nativescript-ng2-fonticon": "^1.3.4",
    "nativescript-ngx-fonticon": "^4.0.0",
    "nativescript-permissions": "^1.2.3",
    "nativescript-pro-ui": "^3.2.0",
    "nativescript-ripple": "^2.0.0",
    "nativescript-snackbar": "^2.0.0",
    "nativescript-theme-core": "~1.0.2",
    "nativescript-toast": "^1.4.6",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.4.2",
    "tns-core-modules": "^3.4.0",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~4.4.1",
    "@ngtools/webpack": "~1.9.4",
    "@types/jasmine": "^2.8.2",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "codelyzer": "^4.0.2",
    "copy-webpack-plugin": "~4.3.0",
    "css-loader": "~0.28.7",
    "extract-text-webpack-plugin": "~3.0.2",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "^0.6.0",
    "nativescript-dev-webpack": "^0.9.2",
    "nativescript-worker-loader": "~0.8.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.2.1",
    "tslint": "^5.8.0",
    "typescript": "^2.4.2",
    "uglifyjs-webpack-plugin": "~1.1.6",
    "webpack": "~3.10.0",
    "webpack-bundle-analyzer": "^2.9.1",
    "webpack-sources": "~1.1.0"
  }
}

@NickIliev I also update the version's required for webpack but its still not working

delanick commented 5 years ago

Am experiencing the same issue.

lettertoamit commented 5 years ago

i am experiencing same issue .

vivek-aecor commented 4 years ago

same issue.

aditya2019 commented 3 years ago

you guys have to make sure that @angular/compiler-cli and angular/core version should be same