compodoc: command not found

5.5k views Asked by At

I installed the documentation tool "Compodoc" in my Angular application. First, I installed the tool globally and in my project

npm install -g @compodoc/compodoc
npm install --save-dev @compodoc/compodoc

I added the command to my package.json file in the "scripts" area with the following line

"compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json"

And it generated me the entire documentation files with this command :

npm run compodoc

Everything went good until I tried to run the command compodoc -s to see the documentation in my browser.

compodoc: command not found
3

There are 3 answers

0
Tobias Etter On BEST ANSWER

Just run "./node_modules/.bin/compodoc -s"

0
Clinton Roy On

In your package.json, for "compodoc" have the options you require and just run "npm run compodoc". For Example: "compodoc": "./node_modules/.bin/compodoc -p tsconfig-compodoc.json -d docs -n \"My Document Name\" --serve --port 3003 --theme postmark --hideGenerator --watch"

It should run. Hope it helped. Thanks:)

0
Pejman Saberin On

Adding this for Angular 9 users:

tell it to create the documentation elsewhere so that 'ng serve' doesn't get confused by the changes caused by the documentation folder if you are using the 'w' folder

Add this package. json then you can run 'npm run compodoc'. Also, In Angular 9, now I see that I have to specify what folder to watch as well - '-w' means watch the source folder.

"scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "compodoc": "./node_modules/.bin/compodoc -p tsconfig.json -w ./src -s --output ../Path To where you want the documentation/documentation --silent" },