Skip to content
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

Cannot use import statement outside a module #385

Open
KarelWintersky opened this issue May 30, 2024 · 2 comments
Open

Cannot use import statement outside a module #385

KarelWintersky opened this issue May 30, 2024 · 2 comments

Comments

@KarelWintersky
Copy link

import imagemin from 'gulp-imagemin';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:76:18)
    at wrapSafe (node:internal/modules/cjs/loader:1283:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at requireOrImport (/var/.../node_modules/gulp-cli/lib/shared/require-or-import.js:20:11)
    at execute (/var/.../node_modules/gulp-cli/lib/versioned/^5.0.0/index.js:35:3)

My deps:

  "dependencies": {
    "gulp": "^5",
    "gulp-imagemin": "^9.1.0"
  }

Node v18.20.3

@robruiz
Copy link

robruiz commented Jan 10, 2025

Im getting this on Node 22 now. What is the fix?

@jcvignoli
Copy link

This worked for me:

#389 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants