generator: EACCESS: permission denied
Describe the bug
Running a simple ag command fails with a permission error
How to Reproduce
$ sudo npm -g install @asyncapi/html-template --unsafe-perm=true
...
$ sudo npm -g install @asyncapi/generator
...
$ ag --debug api_description.yml @asyncapi/html-template
Errors while trying to resolve package location at undefined TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:124:11)
at Object.join (path.js:1039:7)
at /usr/local/lib/node_modules/@asyncapi/generator/lib/generator.js:353:41
at new Promise (<anonymous>)
at Generator.installTemplate (/usr/local/lib/node_modules/@asyncapi/generator/lib/generator.js:339:12)
at Generator.generate (/usr/local/lib/node_modules/@asyncapi/generator/lib/generator.js:168:73)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /usr/local/lib/node_modules/@asyncapi/generator/cli.js:132:9 {
code: 'ERR_INVALID_ARG_TYPE'
}
Template installation started because the template cannot be found on disk
Something went wrong:
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@asyncapi/generator/node_modules/@asyncapi/html-template'
Expected behavior
I expected ag to generate some nice pretty HTML, not try to install files in a system location. I expected ag to find the previously installed template. I also expected that if ag did need to download anything, it would not do so into a place that needed root privileges.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (13 by maintainers)
I’m receiving this error when trying to use the
asyncapi/cli
docker container:Is this expected?
let us then first make sure we support globally installed templates too. Once this works, let us reiterate again to see what else could be done on the generator side.
I’ll make sure to extend logs as much as possible when I will work on enabling global templates support.
if you use CLI it will install under user local where the generator is installed globally. Otherwise, it will install in the project where you use the generator as a library
I’m not sure what is your expectation here towards the generator
I guess I didn’t make myself clear, sorry. I meant that
npm -g install @asyncapi/html-template
global installation of templates was never supported. Just to imply that it is not a bug that generator cannot access a global template. I’m gonna try to enable support this week https://github.com/asyncapi/generator/issues/482#issuecomment-792601786