I have been using react native and expo recently for a class in mobile development and I have been receiving this error when creating new files from command line as well as pulling files from github. I have tried to put the “type”: “module” in the package.json, uninstalling and reinstalling node.js and visual code studio (I am using this program to code), as well as running npm uninstall -g expo-cli
and then npm i -g expo-cli
, but nothing has worked.
Warning: To load an ES module, set “type”: “module” in the package.json or use the .mjs extension.
Use node --trace-warnings ...
to show where the warning was created)
Waiting for the debugger to disconnect…
c:\Users\comp\test\App.js:1
import { StatusBar } from ‘expo-status-bar’;
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (node:internal/modules/cjs/loader:999:16)
at Module._compile (node:internal/modules/cjs/loader:1047:27)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47
Process exited with code 1
(node:19388) Warning: To load an ES module, set “type”: “module” in the package.json or use the .mjs extension.
(Use node --trace-warnings ...
to show where the warning was created)
internal/process/warning:42
Uncaught c:\Users\comp\test\App.js:1
import { StatusBar } from ‘expo-status-bar’;
^^^^^^
SyntaxError: Cannot use import statement outside a module
internal/modules/