eclipse-theia / generator-theia-extension

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

Error: Command failed: npm run prepare #162

Closed Adem-Kri closed 1 year ago

Adem-Kri commented 1 year ago

Am trying to generate a Theia Extension using the command yo theia-extension. During the generation it all went well until reaching here

identical browser-app\package.json
identical electron-app\package.json
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
ysuccess Already up-to-date.
$ theia check:theia-version
✅ Found 3 workspaces
✅ Found 23 dependencies
✅ No issues were found
$ lerna run prepare
lerna info version 2.4.0
hello-world-extension: > hello-world-extension@0.0.0 prepare
hello-world-extension: > yarn run clean && yarn run build
hello-world-extension: yarn run v1.22.19
hello-world-extension: warning package.json: No license field
hello-world-extension: $ rimraf lib
hello-world-extension: Done in 0.20s.
hello-world-extension: yarn run v1.22.19
hello-world-extension: warning package.json: No license field
hello-world-extension: $ tsc
hello-world-extension: src/browser/hello-world-extension-widget.test.ts(5,24): error TS2307: Cannot find module '@testing-library/react' or its corresponding type declarations.
hello-world-extension: src/browser/hello-world-extension-widget.test.ts(27,9): error TS2304: Cannot find name 'expect'.
hello-world-extension: src/browser/hello-world-extension-widget.test.ts(31,21): error TS2304: Cannot find name 'jest'.
hello-world-extension: src/browser/hello-world-extension-widget.test.ts(33,9): error TS2304: Cannot find name 'expect'.
hello-world-extension: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
hello-world-extension: error Command failed with exit code 2.
hello-world-extension: npm ERR! Lifecycle script `prepare` failed with error:
hello-world-extension: npm ERR! Error: command failed
hello-world-extension: npm ERR!   in workspace: hello-world-extension@0.0.0
hello-world-extension: npm ERR!   at location: C:\Users\kriouana\hello-world-extension
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: npm run prepare
lerna ERR! warning package.json: No license field
lerna ERR! warning package.json: No license field
lerna ERR! error Command failed with exit code 2.
lerna ERR! npm ERR! Lifecycle script `prepare` failed with error:
lerna ERR! npm ERR! Error: command failed
lerna ERR! npm ERR!   in workspace: hello-world-extension@0.0.0
lerna ERR! npm ERR!   at location: C:\Users\kriouana\hello-world-extension
lerna ERR!
lerna ERR!
lerna ERR! > hello-world-extension@0.0.0 prepare
lerna ERR! > yarn run clean && yarn run build
lerna ERR!
lerna ERR! yarn run v1.22.19
lerna ERR! $ rimraf lib
lerna ERR! Done in 0.20s.
lerna ERR! yarn run v1.22.19
lerna ERR! $ tsc
lerna ERR! src/browser/hello-world-extension-widget.test.ts(5,24): error TS2307: Cannot find module '@testing-library/react' or its corresponding type declarations.
lerna ERR! src/browser/hello-world-extension-widget.test.ts(27,9): error TS2304: Cannot find name 'expect'.
lerna ERR! src/browser/hello-world-extension-widget.test.ts(31,21): error TS2304: Cannot find name 'jest'.
lerna ERR! src/browser/hello-world-extension-widget.test.ts(33,9): error TS2304: Cannot find name 'expect'.
lerna ERR! info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR!
lerna ERR!     at C:\Users\kriouana\node_modules\execa\index.js:236:11
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: Command failed: npm run prepare
warning package.json: No license field
warning package.json: No license field
error Command failed with exit code 2.
npm ERR! Lifecycle script `prepare` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: hello-world-extension@0.0.0
npm ERR!   at location: C:\Users\kriouana\hello-world-extension

> hello-world-extension@0.0.0 prepare
> yarn run clean && yarn run build

yarn run v1.22.19
$ rimraf lib
Done in 0.20s.
yarn run v1.22.19
$ tsc
src/browser/hello-world-extension-widget.test.ts(5,24): error TS2307: Cannot find module '@testing-library/react' or its corresponding type declarations.
src/browser/hello-world-extension-widget.test.ts(27,9): error TS2304: Cannot find name 'expect'.
src/browser/hello-world-extension-widget.test.ts(31,21): error TS2304: Cannot find name 'jest'.
src/browser/hello-world-extension-widget.test.ts(33,9): error TS2304: Cannot find name 'expect'.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

    at C:\Users\kriouana\node_modules\execa\index.js:236:11
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 1,
  killed: false,
  stdout: '\n' +
    '> hello-world-extension@0.0.0 prepare\n' +
    '> yarn run clean && yarn run build\n' +
    '\n' +
    'yarn run v1.22.19\n' +
    '$ rimraf lib\n' +
    'Done in 0.20s.\n' +
    'yarn run v1.22.19\n' +
    '$ tsc\n' +
    "src/browser/hello-world-extension-widget.test.ts(5,24): error TS2307: Cannot find module '@testing-library/react' or its corresponding type declarations.\r\n" +
    "src/browser/hello-world-extension-widget.test.ts(27,9): error TS2304: Cannot find name 'expect'.\r\n" +
    "src/browser/hello-world-extension-widget.test.ts(31,21): error TS2304: Cannot find name 'jest'.\r\n" +
    "src/browser/hello-world-extension-widget.test.ts(33,9): error TS2304: Cannot find name 'expect'.\r\n" +
    'info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n',
  stderr: 'warning package.json: No license field\n' +
    'warning package.json: No license field\n' +
    'error Command failed with exit code 2.\n' +
    'npm ERR! Lifecycle script `prepare` failed with error: \n' +
    'npm ERR! Error: command failed \n' +
    'npm ERR!   in workspace: hello-world-extension@0.0.0 \n' +
    'npm ERR!   at location: C:\\Users\\kriouana\\hello-world-extension \n',
  failed: true,
  signal: null,
  cmd: 'npm run prepare',
  timedOut: false,
  exitCode: 1
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

     _-----_     ╭───────────────────────╮
    |          |     │      Bye from us!     │
    |--(o)--|     │       Chat soon.      │
   `---------´   │      Yeoman team      │
    ( _´U`_ )      │    http://yeoman.io   │
    /___A___\   /╰───────────────────────╯
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y ` 

So I tried to add the required module '@testing-library/react' but didn't work either, HERE's the end of the log file

3058 verbose npm  v8.19.2
3059 error code 1
3060 error path C:\Users\kriouana\browser-app
3061 error command failed
3062 error command C:\WINDOWS\system32\cmd.exe /d /s /c theia build --mode development
3063 error Failed to resolve module: msgpackr
3063 error Failed to resolve module: socket.io
3063 error Failed to resolve module: ws
3063 error Error: spawn C:\Users\kriouana\node_modules\@theia\application-manager\node_modules\.bin\webpack.cmd ENOENT
3063 error     at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
3063 error     at onErrorNT (node:internal/child_process:485:16)
3063 error     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
3063 error   errno: -4058,
3063 error   code: 'ENOENT',
3063 error   syscall: 'spawn C:\\Users\\kriouana\\node_modules\\@theia\\application-manager\\node_modules\\.bin\\webpack.cmd',
3063 error   path: 'C:\\Users\\kriouana\\node_modules\\@theia\\application-manager\\node_modules\\.bin\\webpack.cmd',
3063 error   spawnargs: [ '--mode', 'development' ]
3063 error }
3064 verbose exit 1
3065 timing npm Completed in 89225ms
3066 verbose unfinished npm timer reify 1667296346040
3067 verbose unfinished npm timer reify:build 1667296413623
3068 verbose unfinished npm timer build 1667296413624
3069 verbose unfinished npm timer build:links 1667296425315
3070 verbose unfinished npm timer build:run:prepare 1667296425315
3071 verbose unfinished npm timer build:run:prepare:browser-app 1667296425315
3072 verbose unfinished npm timer build:run:prepare:electron-app 1667296425344
3073 verbose unfinished npm timer build:run:prepare:hello-world-extension 1667296425381
3074 verbose code 1
3075 error A complete log of this run can be found in:
3075 error     C:\Users\kriouana\AppData\Local\npm-cache\_logs\2022-11-01T09_52_25_897Z-debug-0.log

Here are my specs

win32 {
  node: '16.18.0',
  v8: '9.4.146.26-node.22',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.10',
  openssl: '1.1.1q+quic',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022b',
  unicode: '14.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}
vince-fugnitto commented 1 year ago

@Adem-Kri thank you for reporting the issue, the widget template for the generation works fine for me locally and through ci. Do you mind trying again in a completely new directory (based on the logs it looks like it might have been used before).

For additional information all the dependencies that errored during the build are explicitly declared, it looks like installing them was skipped:

Adem-Kri commented 1 year ago

@vince-fugnitto I closed the issue by mistake, can you reopen it, and of course I don't mind retrying what you asked me for just can you clarify more what am supposed to do

vince-fugnitto commented 1 year ago

I don't mind retrying what you asked me for just can you clarify more what am supposed to do

@Adem-Kri sure:

Adem-Kri commented 1 year ago

@vince-fugnitto As you see I get the same output. it all works fine until reaching browser-app image

image

image

vince-fugnitto commented 1 year ago

@Adem-Kri you're behind a proxy I assume given the fact you can't reach github.com?

Edit: Ah looks like you already opened the discussion, you can continue it there.

Adem-Kri commented 1 year ago

what I can't understand is that am able to clone repo's and install using npm or yarn , I can accede github and also setted this :

git config --global http.proxy http://login:password@company's_domain:port(8080)

Is there something I am missing @vince-fugnitto and thank you for your precious time.

msujew commented 1 year ago

@Adem-Kri Because yarn doesn't use the git configured http-proxy, but instead the HTTP_PROXY env variables. Please see my answer here.