Azure / API-Portal

API Portal lets you create and publish a customized site with API documentation, for free and without writing any code.
MIT License
173 stars 141 forks source link

Local install not working, nor advanced deployments #56

Open DawMatt opened 2 years ago

DawMatt commented 2 years ago

Installs/deployments no longer seem to be working. They typically complain about apim-developer-portal being missing:

npm ERR! Failed at the apim-developer-portal@1.2.0 publish script.

These errors stop any deployments from working, and the deployments are being performed in alignment with the wiki.

The wiki contains "Customize the site" steps ( https://github.com/Azure/API-Portal/wiki ) as follows:

  1. Clone the forked repository to your local environment.
  2. Launch the server.
    1. Open the command line and navigate to the catalog folder with the command cd catalog.
    2. Run npm install to resolve dependencies.
    3. Run npm start to start a local server.

At step 2.b the following warning is returned:

npm WARN apim-developer-portal@1.2.0 No repository field.

At step 2.b the following error is returned, and the website refuses to accepted connections:

WARNING in ./node_modules/any-promise/register.js 24:14-37
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/any-promise/index.js 1:17-38
 @ ./node_modules/koa-router/node_modules/koa-compose/index.js 3:16-38
 @ ./node_modules/koa-router/lib/router.js 9:14-36
 @ ./node_modules/routing-controllers/esm2015/driver/koa/KoaDriver.js 348:39-60
 @ ./node_modules/routing-controllers/esm2015/index.js 2:0-51 83:0-39 83:0-39 114:23-32 121:23-32
 @ ./src/startup.host.ts 7:30-60

WARNING in ./node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/express/lib/application.js 22:11-28
 @ ./node_modules/express/lib/express.js 18:12-36
 @ ./node_modules/express/index.js 11:0-41
 @ ./src/startup.host.ts 4:16-34

WARNING in ./node_modules/routing-controllers/esm2015/util/importClassesFromDirectories.js 28:15-28
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/routing-controllers/esm2015/index.js 5:0-83 140:34-62 146:34-62 152:35-63
 @ ./src/startup.host.ts 7:30-60

3 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in ./node_modules/routing-controllers/esm2015/ActionParameterHandler.js 2:0-63
Module not found: Error: Can't resolve 'class-validator' in '/Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/routing-controllers/esm2015'
resolve 'class-validator' in '/Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/routing-controllers/esm2015'
  Parsed request is a module
  using description file: /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/routing-controllers/package.json (relative path: ./esm2015)
    resolve as module
      /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/routing-controllers/esm2015/node_modules doesn't exist or is not a directory
      /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/routing-controllers/node_modules doesn't exist or is not a directory
      /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules
        single file module
          using description file: /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/package.json (relative path: ./node_modules/class-validator)
            no extension
              /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/class-validator doesn't exist
            .ts
              /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/class-validator.ts doesn't exist
            .tsx
              /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/class-validator.tsx doesn't exist
            .js
              /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/class-validator.js doesn't exist
            .jsx
              /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/class-validator.jsx doesn't exist
        /Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/class-validator doesn't exist
      /Users/mattdawson/Dev/_Github/OAS-API-Examples/node_modules doesn't exist or is not a directory
      /Users/mattdawson/Dev/_Github/node_modules doesn't exist or is not a directory
      /Users/mattdawson/Dev/node_modules doesn't exist or is not a directory
      looking for modules in /Users/mattdawson/node_modules
        single file module
          No description file found in /Users/mattdawson/node_modules or above
          no extension
            /Users/mattdawson/node_modules/class-validator doesn't exist
          .ts
            /Users/mattdawson/node_modules/class-validator.ts doesn't exist
          .tsx
            /Users/mattdawson/node_modules/class-validator.tsx doesn't exist
          .js
            /Users/mattdawson/node_modules/class-validator.js doesn't exist
          .jsx
            /Users/mattdawson/node_modules/class-validator.jsx doesn't exist
        /Users/mattdawson/node_modules/class-validator doesn't exist
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./node_modules/routing-controllers/esm2015/RoutingControllers.js 1:0-66 20:36-58
 @ ./node_modules/routing-controllers/esm2015/index.js 4:0-58 192:8-26
 @ ./src/startup.host.ts 7:30-60

webpack 5.70.0 compiled with 1 error and 3 warnings in 13803 ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! apim-developer-portal@1.2.0 start: `webpack --config webpack.designer.js && webpack --config webpack.host.js && node ./dist/host/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the apim-developer-portal@1.2.0 start 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:

Similarly the "Advanced deployment options" section on the same page contains the following instructions:

You can also run the publishing step locally and deploy the generated static assets from the /catalog/dist/website folder to the hosting solution of choice instead of GitHub Pages. To run the publishing step, execute the command npm run publish on your local machine.

The npm run publish command returned the following:

WARNING in ./node_modules/ws/lib/buffer-util.js 103:21-42
Module not found: Error: Can't resolve 'bufferutil' in '/Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/ws/lib'
 @ ./node_modules/ws/lib/receiver.js 12:42-66
 @ ./node_modules/ws/index.js 7:21-46
 @ ./node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js 7:18-31
 @ ./node_modules/jsdom/lib/jsdom/browser/Window.js 21:22-83
 @ ./node_modules/jsdom/lib/api.js 13:25-61
 @ ./node_modules/@paperbits/common/publishing/dominoHtmlDocumentProvider.ts 4:16-32
 @ ./node_modules/@paperbits/common/publishing/index.ts 27:13-52
 @ ./node_modules/@paperbits/core/core.publish.module.ts 11:21-60
 @ ./src/startup.publish.ts 7:30-76

WARNING in ./node_modules/ws/lib/validation.js 109:22-47
Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/node_modules/ws/lib'
 @ ./node_modules/ws/lib/receiver.js 13:43-66
 @ ./node_modules/ws/index.js 7:21-46
 @ ./node_modules/jsdom/lib/jsdom/living/websockets/WebSocket-impl.js 7:18-31
 @ ./node_modules/jsdom/lib/jsdom/browser/Window.js 21:22-83
 @ ./node_modules/jsdom/lib/api.js 13:25-61
 @ ./node_modules/@paperbits/common/publishing/dominoHtmlDocumentProvider.ts 4:16-32
 @ ./node_modules/@paperbits/common/publishing/index.ts 27:13-52
 @ ./node_modules/@paperbits/core/core.publish.module.ts 11:21-60
 @ ./src/startup.publish.ts 7:30-76

2 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in unable to locate '/Users/mattdawson/Dev/_Github/OAS-API-Examples/catalog/templates/default.json' glob

webpack 5.70.0 compiled with 1 error and 2 warnings in 43251 ms

assets by path assets/monaco-editor/vs/basic-languages/ 423 KiB 75 assets
assets by path assets/monaco-editor/vs/editor/ 3.94 MiB 12 assets
assets by path assets/monaco-editor/vs/language/ 7.1 MiB 8 assets
assets by path styles/ 110 KiB
  asset styles/theme.css 72.1 KiB [compared for emit] (name: styles/theme)
  + 4 assets
assets by path ./ 6.06 MiB
  asset ./scripts/theme.js 6.06 MiB [compared for emit] (name: scripts/theme)
  asset ./styles/theme.js 2.22 KiB [compared for emit] (name: styles/theme)
assets by path assets/monaco-editor/vs/base/ 243 KiB
  asset assets/monaco-editor/vs/base/worker/workerMain.js 177 KiB [compared for emit] [from: node_modules/monaco-editor/min/vs/base/worker/workerMain.js] [copied]
  asset assets/monaco-editor/vs/base/browser/ui/codicons/codicon/codicon.ttf 66.3 KiB [compared for emit] [from: node_modules/monaco-editor/min/vs/base/browser/ui/codicons/codicon/codicon.ttf] [copied]
asset assets/monaco-editor/vs/loader.js 31.8 KiB [compared for emit] [from: node_modules/monaco-editor/min/vs/loader.js] [copied]
asset page.html 411 bytes [compared for emit] [from: src/themes/website/assets/page.html] [copied]
Entrypoint scripts/theme 6.06 MiB = ./scripts/theme.js
Entrypoint styles/theme 74.3 KiB = styles/theme.css 72.1 KiB ./styles/theme.js 2.22 KiB
orphan modules 76.1 KiB (javascript) 937 bytes (runtime) [orphan] 31 modules
runtime modules 1.52 KiB 7 modules
modules by path ./node_modules/ 4.55 MiB
  javascript modules 4.52 MiB 1132 modules
  json modules 33.5 KiB
    modules by path ./node_modules/entities/ 30 KiB 4 modules
    ./node_modules/cheerio/package.json 1.55 KiB [built] [code generated]
    ./node_modules/truncate-html/node_modules/cheerio/package.json 1.78 KiB [built] [code generated]
    ./node_modules/css-select/lib/procedure.json 126 bytes [built] [code generated]
modules by path ./src/ 337 KiB (javascript) 71.5 KiB (css/mini-extract) 103 modules
readable-stream (ignored) 15 bytes [built] [code generated]
readable-stream (ignored) 15 bytes [built] [code generated]
util (ignored) 15 bytes [built] [code generated]
util (ignored) 15 bytes [built] [code generated]
webpack 5.70.0 compiled successfully in 43243 ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! apim-developer-portal@1.2.0 publish: `webpack --config webpack.publisher.js && node dist/publisher/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the apim-developer-portal@1.2.0 publish 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:

Can you please help?

guoqqqi commented 2 years ago

The same error was encountered with yarn start: image

Hi, @DawMatt Have you solved the problem now?

DawMatt commented 2 years ago

@guoqqqi , sorry, no. I've been trying this project on and off for more than a year now ( https://github.com/Azure/API-Portal/issues/21 ) and still the wiki's basic instructions for installing locally don't work.

DawMatt commented 2 years ago

@guoqqqi , actually I retested tonight after upgrading from node v14 LTS to v16 LTS. This seems to be behaving better on my Mac. Might be worth trying if you are running an older version of node. The documentation indicates this project requires a minimum of node v10 but that wiki page hasn't been updated in more than 15 months so it could just be out of date.

guoqqqi commented 2 years ago

Hi, @DawMatt Sorry, I upgraded my node from v14.18.0 to v16.16.0 and reused yarn start and got the same error.🥲 I would like to know how it runs and what the difference is between https://github.com/Azure/api-management-developer-portal. I am researching their functions

DawMatt commented 2 years ago

@guoqqqi , in my case I had to rerun npm install before rerunning npm start. After doing both of those steps the app seemed to behave better. I'm assuming yarn would also require you to do both before the app would behave.

I'm also curious about both of the projects. Docs @ Microsoft seems to have tutorials referring to the other project but I can't find any information about how the two projects compare. Strangely enough while the other project seems more up to date than this I had trouble running it with both v14 LTS and v16 LTS. The only one I can get running right now is this one with v16 LTS.

guoqqqi commented 2 years ago

Hi, @DawMatt Thanks for the detailed answer, it worked fine when I ran the new repository. https://github.com/Azure/api-management-developer-portal