-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyntaxError: Cannot use import statements outside a module #2
Comments
Hello, The reason why import doesn't work is because we don't have babel configured which compiles es6 and other higher version of javascript to the level where all the browsers can understand it. and Node doesn't come with babel or webpack configuration Hope it helps |
As stated, I have a PR that involves running Babel first to solve this issue -thanks! #3 |
Please update your version of Node to latest. and add "type": "module" in the package.json |
System Info:
Error message
SyntaxError: Cannot use import statement outside a module
at Module._compile (internal/modules/cjs/loader.js:891:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! proshop@1.0.0 start:
node backend/server
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the proshop@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/avinash/.npm/_logs/2020-09-30T22_20_45_659Z-debug.log
Debug
The text was updated successfully, but these errors were encountered: