Closed tonyeung closed 7 years ago
opened an issue here first https://github.com/avajs/find-cache-dir/issues/4
not sure why this was happening but it works fine without sudo now
okay, so i screwed up the test file name so ava coudn't find anything to test. After fixing the issue, the same errors are happening again.
Try this:
sudo chown -R $(whoami) $(npm root -g) $(npm root) ~/.npm
after that, you probably won't need to use sudo anymore
@ORESoftware thanks for the advice. I'm going to close these issues since I don't intend on using ava anymore.
For future reference, I suspect the issue here is that dependencies were installed using sudo npm install
. That causes node_modules
to be created with unhelpful permissions. There's ways to change those but really you should avoid using npm
with sudo
.
If you've gotten into this habit for other reasons, perhaps see https://docs.npmjs.com/getting-started/fixing-npm-permissions on how to fix it.
That might be the issue, but still the problem is that ava is creating a node_modules
local dir if there's none create or if it's been installed globally.
This seems to be a genuine issue. In this case, there's no problem since the docker user is privileged to write in the mounted directory. It might be, however. You don't necessarily need to have sudo access, but you do need to have write access to the directory where ava is running.
@JJ fair enough, https://github.com/avajs/ava/pull/2628 should help if you use plain AVA (no Babel or TypeScript providers).
Description
Ava has permissions issues when trying to read/write the node_modules/.cache folder and sub folders. Manually creating the folders and running ava again will cause the next fs operation to fail. Running ava with sudo (
sudo ava
) will let ava run as expected.Is it intended for ava to run with su permissions or require the user to give ava rw permissions to the
.cache/ava
folder?Test Source
Error Message & Stack Trace
Config
Copy the relevant section from
package.json
:Command-Line Arguments
Copy your npm build scripts or the
ava
command used:Relevant Links
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly: