---
title: "Discussion on \"Why Node Says \\\"Cannot use import statement outside a module\\\"\" | Hashnode"
description: "Discussion on \"Why Node Says \\\"Cannot use import statement outside a module\\\"\". Why JavaScript needs modules, how export and import work, default vs named exports, and how to turn modules on, with real output"
url: "https://hashnode.com/posts/javascript-modules-import-export/6b0560061bd18e3dfaa659af"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why Node Says \\"Cannot use import statement outside a module\\"](https://jaydeepkanzariya.hashnode.dev/javascript-modules-import-export?utm_source=hashnode&utm_medium=feed)

Why JavaScript needs modules, how export and import work, default vs named exports, and how to turn modules on, with real output

2h ago · 8 min read · jaydeepkanzariya.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#modules](https://hashnode.com/tag/modules)
-   [#tutorial](https://hashnode.com/tag/tutorial)

## Written by

[Jaydeep Kanzariya](https://hashnode.com/@jaydeepkanzariya)

@jaydeepkanzariya · India

  
[View profile](https://hashnode.com/@jaydeepkanzariya)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
