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 find module 'fs/promises'" #13

Open
mkarras opened this issue Apr 29, 2021 · 11 comments
Open

"Cannot find module 'fs/promises'" #13

mkarras opened this issue Apr 29, 2021 · 11 comments

Comments

@mkarras
Copy link

mkarras commented Apr 29, 2021

The index.cjs.js file in dist folder uses require('fs/promises') instead of require('fs').promises causing "Error: Cannot find module 'fs/promises'".

@mesqueeb
Copy link
Member

mesqueeb commented May 2, 2021

@mkarras where does it throw that error. Can you provide reproduction steps?

@mkarras
Copy link
Author

mkarras commented May 2, 2021

@mesqueeb it is thrown on console when running vue-int --input /src/components --output vetur --recursive or any other generating command.

Which node version do you use? For some 12.X version it won't work. Have a look here.

@mesqueeb
Copy link
Member

mesqueeb commented May 2, 2021

@mkarras I'm not sure how to change the way that the rollup bundles that file. I think the easiest way for me to solve this issue is to find the first nodeJS version that introduced that submodule and make that the minimum compatible nodeJS version.

@mkarras
Copy link
Author

mkarras commented May 2, 2021

Tomorrow i will update to the latest node 12 version. Hopefully this fix the problem. Or I need to monkey patch your module.

@mesqueeb
Copy link
Member

mesqueeb commented May 2, 2021

if it doesn't work let me know !

@mkarras
Copy link
Author

mkarras commented May 2, 2021

Used the latest note 12 version: 12.22.1 with no success. With node 16 it worked. Need to test if nothing break with this version. Which version do you use?

Edit:
Also works with 14.16.1.

@mesqueeb
Copy link
Member

mesqueeb commented May 2, 2021

I will try to rewrite the import logic so rollup bundles differently.

@elielr01
Copy link

elielr01 commented May 10, 2021

I also get this error. Running the command

vue-int --input components --output vetur --recursive

with:

macOS: v11.2.3
Node: v10.23.1

Let me know how I can help :)

@rogier-stegeman
Copy link

Mine is also broken.

  internal/modules/cjs/loader.js:818
    throw err;
    ^

  Error: Cannot find module 'fs/promises'
  (...)
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '(...)/node_modules/@vue-intellisense/scripts/dist/index.cjs.js',
    '(...)/node_modules/vue-intellisense/cli.js'
  ]

@Sandalf
Copy link

Sandalf commented Sep 10, 2021

I got the same error and also had to upgrade node to make it work.

Failed with: node v12.22.6

Worked with: node v14.17.6

@mesqueeb
Copy link
Member

Pr welcome

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

5 participants