'error: _os.platform is not a function after expo start
this error has been bugging me for days, hope someone can help me here
TypeError: _os.platform is not a function. (In '_os.platform()', '_os.platform' is undefined)
at node_modules\react-native\Libraries\LogBox\LogBox.js:148:8 in registerError
at node_modules\react-native\Libraries\LogBox\LogBox.js:59:8 in errorImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:33:4 in console.error
at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:171:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
at node_modules\expo-error-recovery\build\ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at node_modules\regenerator-runtime\runtime.js:45:36 in tryCatch
at node_modules\regenerator-runtime\runtime.js:274:29 in invoke
at node_modules\regenerator-runtime\runtime.js:45:36 in tryCatch
at node_modules\regenerator-runtime\runtime.js:135:27 in invoke
at node_modules\regenerator-runtime\runtime.js:145:18 in PromiseImpl.resolve.then$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
i got this error right after expo start, it happened right after i set some wsl configurations and installed Docker. Thus, i went to find out the codes caused this error, it was from getNodeSystem() in typescript.js which inside node_modules
var isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
var platform = _os.platform();
var useCaseSensitiveFileNames = isFileSystemCaseSensitive();
so i tried to console.log _os value, i found out values are empty objects
function getNodeSystem() {
var nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[a-zA-Z0-9_\s]+(\.js)?$)/;
var _fs = require("fs");
var _path = require("path");
var _os = require("os");
console.log(process.env)
console.log(_fs)
console.log(_path)
console.log(_os)
return value:
Object {
"NODE_ENV": "development",
}
Object {}
Object {}
Object {}
Hope someone can help me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
