yo icon indicating copy to clipboard operation
yo copied to clipboard

SyntaxError: The requested module 'mem-fs' does not provide an export named 'loadFile', SyntaxError: The requested module 'mem-fs' does not provide an export named 'isFileTransform', sharedFs.pipeline is not a function

Open MahmoudY3c opened this issue 1 year ago • 2 comments

Type of issue

  • Hello, I installed yo + generator-code as a dev dependancies by yarn then when ever I try to run npx yo code in the first time I got
import { loadFile } from 'mem-fs';
         ^^^^^^^^
SyntaxError: The requested module 'mem-fs' does not provide an export named 'loadFile'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:213:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async pre (E:\VSCODE Extensions\locales generator\node_modules\yo\lib\cli.js:83:3)
    at async E:\VSCODE Extensions\locales generator\node_modules\yo\lib\cli.js:193:3
  • So I navigated to mem-fs library to export it and after export it I got the following error
file:///E:/VSCODE%20Extensions/locales%20generator/node_modules/mem-fs-editor/dist/actions/commit.js:1
import { isFileTransform } from 'mem-fs';
         ^^^^^^^^^^^^^^^
SyntaxError: The requested module 'mem-fs' does not provide an export named 'isFileTransform'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:213:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)
    at async pre (E:\VSCODE Extensions\locales generator\node_modules\yo\lib\cli.js:83:3)
    at async E:\VSCODE Extensions\locales generator\node_modules\yo\lib\cli.js:193:3
  • So as a try I tried to remove export it because I couldn't find it in mem-fs so i replaced it by true and the tool is running but after questions and when it comes to the last step to generate the files I got that error
Writing in E:\VSCODE Extensions\locales generator\localesgen...
Error code 

sharedFs.pipeline is not a function
  • Please release a new update to fix those issues

My environment

  • OS version/details: Windows 10 64-bit
  • Node version: 20.9.0
  • yarn version: 1.22.21
  • Version of yo : 5.0.0

Expected behavior

  • Just run and ask the questions then generate the files

Current behavior

  • Just a collection of errors

MahmoudY3c avatar Dec 31 '23 13:12 MahmoudY3c

Also tested on the following without success:

  • OS: Alpine, Debian bookworm (both via docker node image), MacOs Ventura 13.6.2
  • Node versions: 18.19.0, 20.9.0
  • yarn versions: 1.22.21, 4.0.2
  • Version of yo : 5.0.0

Switching to using npm resolves the issue so I'm not sure why it is failing with yarn. Not sure, but this might also be related to https://github.com/yeoman/yo/issues/800.

nefrob avatar Jan 06 '24 03:01 nefrob

It's failing even with pnpm. Again, switching to npm resolves the issue.

esskayesss avatar May 13 '24 09:05 esskayesss