eclipse-theia / generator-theia-extension

A Yeoman generator for extensions to the Theia IDE
Other
49 stars 37 forks source link

`-4058 scandir ENOENT` error occurred when creating the `TreeEditor` extension #181

Closed un4gt closed 9 months ago

un4gt commented 10 months ago

When i'm creating TreeEditor extension using command yo theia-extension, i got follow error:

image image

After I created the folder and file manually, the extension was successfully created. But I don't have the above error when creating other extensions.

vince-fugnitto commented 10 months ago

@4EverM thank you for the issue, can you confirm if you are using the latest version of the generator (v0.1.36)? I am unable to reproduce the problem, and CI is also successfully passing when generating the tree-editor template.

un4gt commented 10 months ago

@vince-fugnitto I'm sorry, I forgot to provide version of generator 。 The version on my computer is as follow:

image

I uninstalled yo and generator-theia-extension and reinstalled them, but the problem is still the same!

msujew commented 10 months ago

It might be a Windows specific issue. Maybe it makes sense to add a Windows platform runner to our testing matrix?

I currently don't have access to a Windows machine to reproduce this.

JonasHelming commented 10 months ago

Very likely. The special thing about these two files is that they are moved after the copy.

un4gt commented 10 months ago

I tried it on another windows laptop and cloud server, but the same problem occurs when creating the TreeEditor extension.

windows laptop: image

cloud server: image

I'm using the latest version of the generator (v0.1.36)

metadatadriven commented 9 months ago

Having exactly the same problem on Ubuntu 22.04 (on GitPod)

$ npm list -g --depth 0
/home/gitpod/.nvm/versions/node/v20.9.0/lib
├── corepack@0.20.0
├── generator-theia-extension@0.1.36
├── node-gyp@10.0.1
├── npm@10.1.0
├── pnpm@8.10.5
├── typescript@5.2.2
├── yarn@1.22.21
└── yo@4.3.1

I can create hello-world and widget ok but not TreeEditor

$ yo theia-extension --standalone
? The extension's type TreeEditor
? The extension's name tree-editor
TreeEditor
Please remember to add the standalone extension manually to your root package.json and to your product, e.g. in browser-app/package.json
node:events:492
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, scandir '/workspace/typescript-101/tree-editor/src/browser/README.md'
    at Object.readdirSync (node:fs:1513:3)
    at exports.readdir (/home/gitpod/.nvm/versions/node/v20.9.0/lib/node_modules/generator-theia-extension/node_modules/@mrmlnc/readdir-enhanced/lib/sync/fs.js:18:20)
    at Object.safeCall [as safe] (/home/gitpod/.nvm/versions/node/v20.9.0/lib/node_modules/generator-theia-extension/node_modules/@mrmlnc/readdir-enhanced/lib/call.js:24:8)
    at DirectoryReader.readNextDirectory (/home/gitpod/.nvm/versions/node/v20.9.0/lib/node_modules/generator-theia-extension/node_modules/@mrmlnc/readdir-enhanced/lib/directory-reader.js:78:10)
    at DirectoryReader.stream._read (/home/gitpod/.nvm/versions/node/v20.9.0/lib/node_modules/generator-theia-extension/node_modules/@mrmlnc/readdir-enhanced/lib/directory-reader.js:57:18)
    at Readable.read (node:internal/streams/readable:547:12)
    at readdirSync (/home/gitpod/.nvm/versions/node/v20.9.0/lib/node_modules/generator-theia-extension/node_modules/@mrmlnc/readdir-enhanced/lib/sync/index.js:27:21)
    at Function.readdirSyncStat (/home/gitpod/.nvm/versions/node/v20.9.0/lib/node_modules/generator-theia-extension/node_modules/@mrmlnc/readdir-enhanced/lib/index.js:34:10)
    at ReaderSync.dynamicApi (/home/gitpod/.nvm/versions/node/v20.9.0/lib/node_modules/generator-theia-extension/node_modules/fast-glob/out/providers/reader-sync.js:64:24)
    at ReaderSync.api (/home/gitpod/.nvm/versions/node/v20.9.0/lib/node_modules/generator-theia-extension/node_modules/fast-glob/out/providers/reader-sync.js:56:25)
Emitted 'error' event on Readable instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/workspace/typescript-101/tree-editor/src/browser/README.md'
}
JonasHelming commented 9 months ago

I think I have a fix, but I cannot test it, as I cannot reproduce the issue on my machine. Could you maybe see whether this fixes your issue: https://github.com/eclipse-theia/generator-theia-extension/pull/184 You can

metadatadriven commented 9 months ago

Yes that seems to work. Getting a bunch of warnings, but it creates the extension files:

$ yo theia-extension --standalone
(node:8528) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8528) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:8528) Warning: Accessing non-existent property 'which' of module exports inside circular dependency
? The extension's type TreeEditor
? The extension's name tree-editor
TreeEditor
Please remember to add the standalone extension manually to your root package.json and to your product, e.g. in browser-app/package.json
   create tree-editor/package.json
   create tree-editor/tsconfig.json
   create tree-editor/src/browser/example-file/example-file-command.ts
   create tree-editor/src/browser/example-file/example-file-contribution.ts
   create tree-editor/src/browser/style/editor.css
   create tree-editor/src/browser/tree/tree-editor-widget.ts
   create tree-editor/src/browser/tree/tree-label-provider.ts
   create tree-editor/src/browser/tree/tree-model-service.ts
   create tree-editor/src/browser/tree/tree-model.ts
   create tree-editor/src/browser/tree/tree-node-factory.ts
   create tree-editor/src/browser/tree/tree-schema.ts
   create tree-editor/README.md
   create tree-editor/src/browser/tree-contribution.ts
   create tree-editor/src/browser/tree-editor-frontend-module.ts
   create tree-editor/src/browser/tree-label-provider-contribution.ts