Cannot use import statement outside a module
https://developers.apify.com/academy/web-scraping-for-beginners/crawling/pro-scraping#crawlee-installation
I created new folder and run this:
npm install crawlee@latestThen I create crawlee.js with this:
import { CheerioCrawler } from 'crawlee';console.log('Crawlee works!');Then I run this:
node crawlee.jsAnd I get this:
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Why is that?
