Cannot install Wrangler on Chromebook

I’m on my Google Pixelbook Go Chromebook. I’m in terminal, trying to install Wrangle to run CLI. I’m using sudo, but I keep getting permission denied error on /root/.wrangler folder.

I’d switch to a root shell with sudo -s and then run the commands.

Also, why did you run mkdir manually? Remove the directory and try again.

The manual mkdir was a second attempt to fix error. Got that exact same error on first try prior to my failed manual mkdir fix attempt.

I’ll try the -s switch. Thanks!

Well, creating the directory apparently works. So I’d really try it with the shell, though why do you want to install it under root?

Cloudflare CLI install instructions say this for install: npm install -g @cloudflare/wrangler

Sure, but it doesnt say root anywhere.

Did it work with a root shell?

No it does not work in root shell. I got it to work by removing the -g “global” option. This seems only way to do it. Perhaps site instructions should be updated for Linux/Chromebooks?

I am not sure if this is an issue with Chromebooks. If you cant even run it as root, there must be something off. But again, I wouldnt run it as root in the first place.

You have no choice. If you do not use sudo you cannot install it at all. If you use sudo, you get the error I posted. The npm package tries to install in /root/.wrangler and this is not allowed. Only way around, as I said, is to not install with global -g flag. Then it works. I have not tested CLI yet. I will now.

It would genuinely surprise me if Wrangler tried to save something hardcoded in /root. It tried to access that directory because you were root. Are you saying it tried to access that directory a regular user as well?

You cannot even begin to install this npm package globally without using sudo. The install errors because it is not allowed to write in folder /root/.wrangler. The npm package is trying to write in the folder. I’m not doing that manually.

Do you have a Chromebook? You can see for yourself.

My attempt to remove -g does not work. It must be installed globally to work. It appears to install without the -g flag, however when you type: wrangler config, you get wrangler not found.

So I’m blocked.

Do you get I’m simply cutting/pasting from the Cloudflare CLI install instructions?

Alright, with -g it seems to install it under Node’s directory. If that is configured as /root in your case that will explain why it tries to access it. You should probably change that to the correct directory.

I just installed it with and without -g and it worked in both cases fine.

This is no where near my first npm install on this Chromebook. I have 100s and 100s and 100s installed already.

You’re suggesting I uninstall Node and/or NPM to make this work? This is my very first failed npm package install on this chromebook

That is probably a question better for an NPM forum. What I am saying is that I managed to install it without root privileges and with -g it installed in Node’s directory, hence my assumption that is not correctly set for some reason.

I temporarily adjusted permissions on /usr/lib/node_modules folder and then I was able to install Wrangler globally without sudo. I then reset the default permissions on that folder.

Thank you @sandro for helping. I definitely appreciate :slight_smile: