[Solved] File watch problem with node package
I'm using node apidoc package (http://apidocjs.com/) to create api documentation from my phpdoc comments that are located in directories where Laravel store all its controllers. I invoke command from command line (Windows or Vagrant box) with:
apidoc -i "app\Http" -f ".*\\.php$" -o "apidoc/"
Looking some tutorials and doc about file watchers I first created custom scope "API Doc JS" which holds all php files within controller directory - file[project_dir]:app/Http//* , after that I have created new watcher with following options:
Name: API Doc JS
File type: PHP file
[off] Immediate file synch
[off] Trigger watcher regardless of syntax errors
Scope: API Doc JS
Program: apidoc
Arguments: -i "app\Http" -f ".*\\.php$" -o "apidoc/"
Working directory: $ProjectFileDir$
but console prints this error:
An exception occurred while executing watcher 'API Doc JS'. Watcher has been disabled. Fix it.: Cannot run program "apidoc" (in directory "C:\<path-to-project>\code"): CreateProcess error=2, The system cannot find the file specified
I located where apidoc is located and it is in:
C:\Users\sensei\AppData\Roaming\npm\apidoc
C:\Users\sensei\AppData\Roaming\npm\apidoc.cmd
I set new properties for watcher:
Program: "C:\Users\sensei\AppData\Roaming\npm\apidoc.cmd"
Arguments: (none)
Working directory: $ProjectFileDir$
and get new error:
cmd.exe /D /C C:/Users/sensei/AppData/Roaming/npm/apidoc.cmd
error: Error: ENOENT, no such file or directory 'C:\<path-to-project>\code\node_modules\.bin\gulp'
Process finished with exit code 0
Any help or suggestions are welcome!
Please sign in to leave a comment.
"C:\Users\sensei\AppData\Roaming\npm\apidoc.cmd" is a correct program path. Why did you leave 'Arguments' field empty?You shouls have passed -i , etc. options. In your system console, cd to your project folder and run C:\Users\sensei\AppData\Roaming\npm\apidoc.cmd there - what is the result?
I also tried with some arguments (-i "app\Http" -f ".*\\.php$" -o "apidoc/") as stated at the first part of post. Calling
"C:\Users\sensei\AppData\Roaming\npm\apidoc.cmd" -o "apidoc/"
throws error
error: Error: ENOENT, no such file or directory 'C:\<project-path>\code\node_modules\.bin\gulp'
"Code" is directory where Laravel instalation is.
yes - but you did it before specifying the correct path to the program... Can you execute "C:\Users\sensei\AppData\Roaming\npm\apidoc.cmd" -i "app\Http" -f ".*\\.php$" -o "apidoc/" in console? Not sure why calling 'apidoc' and 'C:\Users\sensei\AppData\Roaming\npm\apidoc.cmd' give you different results...
I found where was the problem. So everyone reading thread have to setup file watcher as:
Program: "C:\Users\sensei\AppData\Roaming\npm\apidoc.cmd" (which I already have setup)
Arguments: -i "$ProjectFileDir$\app\Http" -f ".*\\.php$" -o "$ProjectFileDir$\apidoc\"