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

SyntaxError: Named export 'getStreamAsBuffer' not found #1406

Closed
consdu opened this issue Apr 25, 2024 · 2 comments
Closed

SyntaxError: Named export 'getStreamAsBuffer' not found #1406

consdu opened this issue Apr 25, 2024 · 2 comments

Comments

@consdu
Copy link

consdu commented Apr 25, 2024

Description

Trying to run last version of lint-staged and I'm getting this error :

import getStream, {getStreamAsBuffer} from 'get-stream';
                   ^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'getStreamAsBuffer' not found. The requested module 'get-stream' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'get-stream';
const {getStreamAsBuffer} = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Node.js v18.18.0
husky - pre-commit hook exited with code 1 (error)

Steps

  1. Install last version in already existing project with Next.js 14 / Webpack
  2. Add Husky pre commit hook
  3. Try to commit and getting the error, so basically it doesn't even run

Environment

  • OS:MacOS Sonoma 14.4.1
  • Node.js:18.18.0
  • lint-staged: latest
@iiroj
Copy link
Member

iiroj commented Apr 28, 2024

Hello, this is not something used directly in lint-staged so it might a problem with your node_modules/. I would try installing again:

rm -rf package-lock.json node_modules
npm install

@consdu
Copy link
Author

consdu commented Apr 29, 2024

Ok, thanks a lot for the answer!

@consdu consdu closed this as completed Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants