Ionic-app-scripts: TypeError: Cannot read property 'rootDir' of undefined - @ionic/app-scripts 0.0.47

Created on 13 Dec 2016  路  6Comments  路  Source: ionic-team/ionic-app-scripts

Good afternoon,

I do Ionic CLI with customization to use Angular 2 framework instead of Ionic 2 framework.

When I update @ionic/app-scripts 0.0.47, I get error when I do "ionic serve".

[15:54:06]  build dev finished in 12.03 s
There was an error in config file "C:\work\www\ionic\ionic-0.2\watch.config.js". Using defaults instead.
**TypeError: Cannot read property 'rootDir' of undefined**
    at Object.getUserConfigFile (C:\work\www\ionic\ionic-0.2\node_modules\@ionic\app-scripts\dist\util\config.js:96:35)
    at Object.copyConfigToWatchConfig (C:\work\www\ionic\ionic-0.2\node_modules\@ionic\app-scripts\dist\copy.js:236:31)
    at Object.<anonymous> (C:\work\www\ionic\ionic-0.2\watch.config.js:11:20)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
[15:54:06]  dev server running: http://localhost:8100/

Below is my copy.config.js

module.exports = {
  copyAssets: {
    src: ['{{SRC}}/assets/**/*'],
    dest: '{{WWW}}/assets'
  },
  copyIndexContent: {
    src: ['{{SRC}}/index.html'],
    dest: '{{WWW}}'
  },
  copyPolyfills: {
    src: ['{{SRC}}/etc/hack/polyfills/polyfills.js'],
    dest: '{{BUILD}}'
  }
}

Below are my watch.config.js

var watch = require('./node_modules/@ionic/app-scripts/dist/watch');
var copy = require('./node_modules/@ionic/app-scripts/dist/copy');
var copyConfig = require('./copy.config');
module.exports = {
  srcFiles: {
    paths: ['{{SRC}}/**/*.(ts|html|scss)'],
    options: { ignored: ['{{SRC}}/**/*.spec.ts', '**/*.DS_Store'] },
    callback: watch.buildUpdate
  },
  copyConfig: copy.copyConfigToWatchConfig()
};

Below are my "ionic info"

Your system information:

 ordova CLI: 6.4.0
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed

When I added

copyConfig: copy.copyConfigToWatchConfig({ rootDir:'.' })

It produces another error saying 'cannot find module copy.config.js'

Most helpful comment

This issue will be resolved in 0.0.48 that will be released tomorrow. I'll close after we publish.

Thanks,
Dan

All 6 comments

I have the same issue.

package.json
```
"config": {
...
"ionic_webpack": "./config/webpack.config.js",
"ionic_watch": "./config/watch.config.js",
"ionic_copy": "./config/copy.config.js"
}
}

/config/watch.config.js

const watchConfig = require('../node_modules/@ionic/app-scripts/config/watch.config');
watchConfig.srcFiles.options.ignored.push('{{SRC}}*/.e2e.ts');
module.exports = watchConfig;

Error on ionic serve command:

There was an error in config file "/Users/marco/Sources/Gitlab/p/config/watch.config.js". Using defaults instead.
TypeError: Cannot read property 'rootDir' of undefined
at Object.getUserConfigFile (/Users/marco/Sources/Gitlab/p/node_modules/@ionic/app-scripts/dist/util/config.js:96:35)
at Object.copyConfigToWatchConfig (/Users/marco/Sources/Gitlab/p/node_modules/@ionic/app-scripts/dist/copy.js:236:31)
at Object. (/Users/marco/Sources/Gitlab/p/node_modules/@ionic/app-scripts/config/watch.config.js:16:20)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)

Ionic Info:

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: 1.9.0
ios-sim version: 5.0.12
OS: OS X El Capitan
Node Version: v7.1.0
Xcode version: Xcode 8.1 Build version 8B62

```
Also @danbucholtz can you please add e2e files to the ignore lists in the next releases ? I made a PR same time ago but i got no answers...

This issue will be resolved in 0.0.48 that will be released tomorrow. I'll close after we publish.

Thanks,
Dan

Hello,
The nightly version fix that problem, but now, I've got white screen + loader on iOS build.
Any news about the 0.0.48 @danbucholtz ?
Thanks!

Looking forward for 0.0.48 too :+1:

:+1:

Hi all,

This is resolved in 0.0.48 which was just published.

Please let me know if you have any issues.

Thanks,
Dan

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ValterSantosMatos picture ValterSantosMatos  路  63Comments

biesbjerg picture biesbjerg  路  78Comments

shlomiassaf picture shlomiassaf  路  83Comments

Manduro picture Manduro  路  78Comments

chriswep picture chriswep  路  72Comments