passbolt / passbolt_cli

Command line interface for passbolt API
GNU Affero General Public License v3.0
146 stars 30 forks source link

Missing cookie.json #34

Open CasvalDOT opened 4 years ago

CasvalDOT commented 4 years ago

Hi, after i've installed node 14 the cli seems no work anymore. Each command generated this warning:

Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency

Each command i run return the following error:

{ errno:-2, code:'ENOENT', syscall:'open', path: '/usr/lib/node_modules/passbolt_cli/app/tmp/cookie.json' }

I've created manuallty the tmp folder adding a blank file called cookie.json, and then I've change the ownership of the folder:

sudo chown -R <my_user>:<my_user> /usr/lib/node_modules/passbolt_cli/app/tmp

now it works again, but I supposed this is not the correct behavior. I've forgot something in the configuration procedure or it is a bug?

PS. the passbolt_cli is installed globally

stripthis commented 4 years ago

Hi there,

Sorry for the late reply, by default you should have a app/tmp directory created, as there is a file named "empty", as placeholder. Maybe your issue was that it was not writable by the user using passbolt cli globally?

CasvalDOT commented 3 years ago

Thanks for the reply and sorry for the late answer. Surely my user has not write permission to /usr folder running the CLI (probabily only with sudo it can write in /usr directory). I don't know if this folder should be created during installation process. Maybe is better create this folder in user home directory instead. What do you think? This should prevent this behavior.

almereyda commented 2 years ago

This also happened to me with a global install, yet within an NVM environment:

$ passbolt auth login
/home/yala/.nvm/versions/node/v14.18.2/lib/node_modules/passbolt_cli/node_modules/tough-cookie-file-store/lib/file-store.js:214
        if (err) throw err;
                 ^

[Error: ENOENT: no such file or directory, open '/home/yala/.nvm/versions/node/v14.18.2/lib/node_modules/passbolt_cli/app/tmp/cookie.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/yala/.nvm/versions/node/v14.18.2/lib/node_modules/passbolt_cli/app/tmp/cookie.json'
}

Creating the tmp directory directory was sufficient for this to continue to work:

$ mkdir /home/yala/.nvm/versions/node/v14.18.2/lib/node_modules/passbolt_cli/app/tmp
$ passbolt auth login
$ ls /home/yala/.nvm/versions/node/v14.18.2/lib/node_modules/passbolt_cli/app/tmp
cookie.json

It appears this is a packaging failure, as the node_modules directories should not be written other than by NPM, and we have explicitly created a ~/.config/passbolt/ directory during setup, where such transitory data could also be kept.