-
Notifications
You must be signed in to change notification settings - Fork 334
Unable to install wrangler globally inside a Docker container when I have root access. #803
Comments
Hey @dompuiu, I did something similar recently with the wrangler GitHub action integration we just launched: https://github.com/cloudflare/wrangler-action/blob/master/entrypoint.sh Maybe that'd be helpful? FWIW, I think those containers run with a user |
I've tried to use some commands from that file. But I was still not able to make it work. As a side note, I tried also installing node using the following commands (so no NVM):
With the node installed this way I get a different error:
Even if I create the |
I've been unable to install on MacOSX for months. Block by the same issue. Running as sudo. Re-installed node & npm.
Even if I create all the directories manually the script tries to create them iself instead of checking first and fails. |
@bladerunner41 Unfortunately, For @dompuiu, I'd maybe try running |
Hey @dompuiu! I think you were actually very close to getting this working in your initial bug report. As per the README, we recommend installing Wrangler via NVM or a similar Node package manager, as it should simplify any potential permissions issues. In your original bug report, it seems like things work until you get to installing Wrangler. In my GitHub action code, I set the export HOME="/github/workspace"
export NVM_DIR="/github/workspace/nvm"
export WRANGLER_HOME="/github/workspace"
mkdir -p "$HOME/.wrangler"
chmod -R 770 "$HOME/.wrangler" FWIW, I'd also make sure that whenever you're using |
@signalnerve I was able to make it work using some of the steps you provided. Thanks! For anyone interested these are the steps that I run inside the ubuntu container:
My real setup is more complicated, but I will be able to make it work. I think the lesson is that you cannot install the wrangler tool as root using the default HOME directory. |
Ah, exciting that you got it working! Please let us know if there's anything in particular you think we should do to make documentation around this better. Thanks @dompuiu! |
i think this issue is now resolved- so i am going to close! i do think we should better document these features- and have filed this issue to track that work: cloudflare/workers-docs#481 thanks everyone! |
Apologies for re-opening this, however I came across this issue and the above steps didn't work (for my node environment, not ubuntu) - however for future readers, the following worked for me: FROM node:12.13.0
WORKDIR /app
COPY package.json package.json
RUN npm i -g @cloudflare/wrangler --unsafe-perm=true --allow-root
RUN npm i
RUN wrangler --version |
thx @blackn1ght soved my problem. |
Fixing my npm following did work. |
@blackn1ght you legend! I've been trying to crack this for hours. This is what did the trick for me |
This saved me. Thanks @dompuiu Finally I found this code while searching for solution here. Following is for people like me who have hard time installing wrangler in Ubuntu
Resulted in:
|
there is no Quoting from: https://github.com/nvm-sh/nvm#verify-installation Please note that |
@rochapablo You fixed my issue after a few hours of getting frustrated. Thanks! |
Adding this here as it was the first result when I googled my error: If none of the above works for anyone else using nvm, I added original error: npm ERR! code 127
npm ERR! path /root/.nvm/versions/node/v15.6.0/lib/node_modules/@cloudflare/wrangler
npm ERR! command failed
npm ERR! command sh -c node ./install-wrangler.js
npm ERR! sh: node: command not found |
🐛 Bug Report
I am trying to install wrangler inside a Docker container using the NPM -g flag. The Node was installed inside the container using NVM.
Environment
rustc -V
:node -v
: v13.0.1wrangler -V
:Steps to reproduce
You need to have docker install on your machine.
Start an Ubuntu container:
You will get inside the bash of that container.
Install curl:
Install NVM:
Load NVM:
Install a node version:
Install wrangler:
What did you expect to see?
I was hoping wrangler would get installed.
What did you see instead?
The text was updated successfully, but these errors were encountered: