I just updated my ionic project to latest version, now when I want to start it (browser) it only shows the error in the browser:
"os.homedir is not a function"
The line it complains is:
exports.CONFIG_DIRECTORY = path.resolve(os.homedir(), '.ionic');
Any ideas?
ionic info
global packages:
@ionic/cli-utils : 1.4.0 Cordova CLI : 7.0.1 Ionic CLI : 3.4.0
local packages:
@ionic/app-scripts : 1.3.7 @ionic/cli-plugin-cordova : 1.0.0 @ionic/cli-plugin-ionic-angular : 1.0.0 Ionic Framework : ionic-angular 3.5.0
System:
Node : v7.9.0 OS : Windows 10 Xcode : not installed ios-deploy : not installed ios-sim : not installed npm : 4.2.0
edit:
Adding “console.log(os)” in front of this line, results in:
→ Webstorm console shows an printed object WITH “homedir” function.
→ Browser console shows an printed object WITHOUT “homedir” function.
Not sure where these should be coming from…
edit2:
Seems like it should be coming from “os-homedir” npm package, which is actually there. Maybe webpack throws it out?
Stacktrace is:
Uncaught TypeError: os.homedir is not a function
at Object.P (config.js:87)
at __webpack_require__ (bootstrap 6d6a37e…:19)
at Object.P (index.js:20)
at __webpack_require__ (bootstrap 6d6a37e…:19)
at Object.<anonymous> (dot.model.ts:5)
at __webpack_require__ (bootstrap 6d6a37e…:19)
at Object.<anonymous> (playground.page.ts:20)
at __webpack_require__ (bootstrap 6d6a37e…:19)
at Object.<anonymous> (dotpuz.module.ts:48)
at __webpack_require__ (bootstrap 6d6a37e…:19)
edit3:
I tried fixing it by adding the code from os-homedir package into browser.js from os-browserify package, but that threw up new errors because homedir() is returning NULL. Having a deeper look it seems like this is nodeJS code which should never be called in browser at all?