vue-intellisense icon indicating copy to clipboard operation
vue-intellisense copied to clipboard

"Cannot find module 'fs/promises'"

Open mkarras opened this issue 3 years ago • 11 comments

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

mkarras avatar Apr 29 '21 09:04 mkarras

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

mesqueeb avatar May 02 '21 01:05 mesqueeb

@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.

mkarras avatar May 02 '21 05:05 mkarras

@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.

mesqueeb avatar May 02 '21 10:05 mesqueeb

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

mkarras avatar May 02 '21 20:05 mkarras

if it doesn't work let me know !

mesqueeb avatar May 02 '21 21:05 mesqueeb

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.

mkarras avatar May 02 '21 21:05 mkarras

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

mesqueeb avatar May 02 '21 22:05 mesqueeb

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 :)

elielr01 avatar May 10 '21 05:05 elielr01

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'
  ]

rogier-stegeman avatar Jul 07 '21 08:07 rogier-stegeman

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

Sandalf avatar Sep 10 '21 20:09 Sandalf

Pr welcome

mesqueeb avatar Sep 11 '21 12:09 mesqueeb