microsoft / azure-devops-extension-sample

Sample web extension for Azure DevOps
MIT License
240 stars 159 forks source link

Running this sample gives errors only so far :( #62

Closed buysoft closed 2 years ago

buysoft commented 3 years ago

I am new to developing a extension for Azure DevOps. Trying to get this up and running but when I am trying to do npm run build it tells me no rimraf exists.

After that I installed rimraf but then I get another issue with the Copy Plugin. Anyone familiar with this issue?

karelkral commented 3 years ago

You should be more specific about Copy Plugin error. This says nothing.

Good start with Az DevOps plugin is here. There is a good explanation of how to start and also this project offers the hot reload while debugging.

stestp commented 3 years ago

I have the same problem. It doesn't work directly. I don't like it as first contact. There a some solutions (for windows). I don't solved everything. For now I give up. I hope you will help me.

Enviroment variable can't set:

PS C:\Projects\sst-devops-extension>tfx extension init
TFS Cross Platform Command Line Interface v0.9.2
Copyright Microsoft Corporation

  --  New Azure DevOps Extension  --

For all options and help, run `tfx extension init --help`

> Publisher ID: xxxx
> Extension ID:
error:   Invalid input for Extension ID:
> Extension ID: xxxx
> Extension name: Test of xxxx
> Which samples do you want to start with? You may specifiy multiple (comma-separated).
For descriptions, see https://github.com/Microsoft/azure-devops-extension-sample.
  (A)ll, 
  (F)eature, 
  (H)ub, 
  (M)enu, 
  (P)anel, 
  Pi(v)ot, 
  (W)orkItemOpen, 
  (N)one - empty project
 (default = All): W
Downloading sample package from https://codeload.github.com/Microsoft/azure-devops-extension-sample/zip/master
Package downloaded to C:\Projects\sst-devops-extension\azure-devops-extension-sample.zip (176 kB)
Including the following samples: 
 - WorkItemOpen
Updating azure-devops-extension.json with publisher ID, extension ID, and extension name.
Running `npm install` in C:\Projects\sst-devops-extension... please wait.
Building sample with `npm run build`
error: Error: Command failed: npm run compile:dev
error: 'env' is not recognized as an internal or external command,
error: operable program or batch file.
error: npm ERR! code ELIFECYCLE
error: npm ERR! errno 1
error: npm ERR! testOfSst@1.0.0 test: `env TEST_REPORT_FILENAME=test-results.xml jest --verbose`
error: npm ERR! Exit status 1
error: npm ERR! 
error: 
error: npm ERR! A complete log of this run can be found in:
error: npm ERR!     C:\Users\sst\AppData\Roaming\npm-cache\_logs\2021-05-03T07_17_49_596Z-debug.log
error: npm ERR! code ELIFECYCLE
error: npm ERR! errno 1
error: npm ERR! testOfSst@1.0.0 compile:dev: `npm run clean && npm run test && webpack --mode development`
error: npm ERR! Exit status 1
error: npm ERR! 
error: npm ERR! Failed at the testOfSst@1.0.0 compile:dev script.
error: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
error: 
error: npm ERR! A complete log of this run can be found in:
error: npm ERR!     C:\Users\sst\AppData\Roaming\npm-cache\_logs\2021-05-03T07_17_49_629Z-debug.log
error: 
PS C:\Projects\sst-devops-extension>

https://stackoverflow.com/a/63456002/13853555 So "cygwin" or "change to set" is necessary. I wish a note in your readme!

webpack installation

Then you have to install webpack. I wish a note in your readme!

TODO: Solve the webpack problem

PS C:\Projects\sst-devops-extension> npm run build:dev 

> testOfSst@1.0.0 build:dev C:\Projects\sst-devops-extension
> npm run compile:dev && npm run postbuild

> testOfSst@1.0.0 compile:dev C:\Projects\sst-devops-extension
> npm run clean && npm run test && webpack --mode development

> testOfSst@1.0.0 clean C:\Projects\sst-devops-extension
> rimraf ./dist

> testOfSst@1.0.0 test C:\Projects\sst-devops-extension
> set TEST_REPORT_FILENAME=test-results.xml jest --verbose

[webpack-cli] Failed to load 'C:\Projects\sst-devops-extension\webpack.config.js' config
[webpack-cli] ReferenceError: globalThis is not defined
    at Object.<anonymous> (C:\Projects\sst-devops-extension\node_modules\queue-microtask\index.js:5:25)
    at Module._compile (C:\Projects\sst-devops-extension\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
    at Module.load (internal/modules/cjs/loader.js:630:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
    at Function.Module._load (internal/modules/cjs/loader.js:562:3)
    at Module.require (internal/modules/cjs/loader.js:667:17)
    at require (C:\Projects\sst-devops-extension\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at Object.<anonymous> (C:\Projects\sst-devops-extension\node_modules\run-parallel\index.js:4:24)
    at Module._compile (C:\Projects\sst-devops-extension\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! testOfSst@1.0.0 compile:dev: `npm run clean && npm run test && webpack --mode development`
npm ERR! Exit status 2
npm ERR! Failed at the testOfSst@1.0.0 compile:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! testOfSst@1.0.0 build:dev: `npm run compile:dev && npm run postbuild`
npm ERR! Exit status 2
npm ERR! Failed at the testOfSst@1.0.0 build:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
PS C:\Projects\sst-devops-extension>
karelkral commented 3 years ago

Problem with "env is not defined": You should modify the script for windows, so it will contain: "test": "set TEST_REPORT_FILENAME=test-results.xml && jest --verbose" So use set instead of env. Env is specific for Linux.

About the second problem: I am not sure. Do you have Node installed? Did you run the command npm install?

stestp commented 3 years ago

Thank you for your quick answer!

Problem with "env is not defined": You should modify the script for windows, so it will contain: "test": "set TEST_REPORT_FILENAME=test-results.xml && jest --verbose" So use set instead of env. Env is specific for Linux.

I know it already. You can see it in my previous post:

https://stackoverflow.com/a/63456002/13853555 So "cygwin" or "change to set" is necessary. I wish a note in your readme!


About the second problem: I am not sure. Do you have Node installed? Did you run the command npm install?

Yes, I already did it. It's the same problem.

stestp commented 3 years ago

Installing new nodejs is helpfull. This was my mistake. Sorry!

scottdallamura commented 2 years ago

updated to use cross-env. it works now for me on windows