Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

wrangler was not installed successfully #1479

Closed
istiyakamin opened this issue Aug 4, 2020 · 7 comments
Closed

wrangler was not installed successfully #1479

istiyakamin opened this issue Aug 4, 2020 · 7 comments
Labels
onboarding Issues with installation or login

Comments

@istiyakamin
Copy link

wrangler was not installed successfully

/usr/lib/node_modules/@cloudflare/wrangler/node_modules/binary-install/src/binary.js:60 throw You have not installed ${this.name ? this.name : "this package"}; ^ You have not installed wrangler (Use node --trace-uncaught ...to show where the exception was thrown)

@rodrigopv
Copy link

rodrigopv commented Aug 5, 2020

Happened the same to me on debian stretch. I supposed it was because my NPM install was done with APT.

I've tried another VM with Ubuntu 20.04, with Node installed from NVM and then:

# npm -g install @cloudflare/wrangler
/root/.nvm/versions/node/v10.20.1/bin/wrangler -> /root/.nvm/versions/node/v10.20.1/lib/node_modules/@cloudflare/wrangler/run-wrangler.js

> @cloudflare/wrangler@1.10.3 postinstall /root/.nvm/versions/node/v10.20.1/lib/node_modules/@cloudflare/wrangler
> node ./install-wrangler.js

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/root/.nvm/versions/node/v10.20.1/lib/node_modules/@cloudflare/wrangler/install-wrangler.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @cloudflare/wrangler@1.10.3 postinstall: `node ./install-wrangler.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @cloudflare/wrangler@1.10.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-08-05T03_11_04_972Z-debug.log

Didn't work either.

Other packages like express install just fine:

~# npm install -g express
+ express@4.17.1

So after a decent amount of time spent, I just grabbed the binary from here: https://github.com/cloudflare/wrangler/releases/download/v1.10.3/wrangler-v1.10.3-x86_64-unknown-linux-musl.tar.gz

And then the python example didn't worked on Debian 9 (probably due to python 3.5). I tried again in the Ubuntu 20.04 VM (where I've installed the binary directly too).

I tried to import json to serialize/deserialize from python and it shows the error:
Can't import module 'codecs'

Having problem installing the tool and then it's not possible to do more than a hello world at python makes me think it's worth to rely on workers at the moment if you aren't trying to use javascript.

@EverlastingBugstopper
Copy link
Contributor

you might need to update node

@samkelleher
Copy link

I'm on node 15 and have the same issue.

  • npm install @cloudflare/wrangler
  • run npm run publish using example package json below, get the above error

example package.json:

{
  "private": true,
  "dependencies": {
    "@cloudflare/wrangler": "^1.11.0"
  },
  "scripts": {
    "worker:publish": "wrangler publish"
  }
}

@13r0ck
Copy link

13r0ck commented Nov 20, 2020

I was having the same issue. I was unable to get the npm install to work, but I was able to get cargo install wrangler to work by installing perl.
I'm on Fedora Linux so sudo dnf install perl -y worked for me :)

@Electroid Electroid added onboarding Issues with installation or login and removed subject - installer labels Feb 22, 2021
@xortive
Copy link
Contributor

xortive commented Feb 25, 2021

@rodrigopv it looks like you're trying to run npm install -g @cloudflare/wrangler as root, since /root is appearing in your error message.

The wrangler npm installer does not support running as root, as npm runs the postinstall script as the nobody user to prevent malicious postinstall scripts from causing damage to your system. Please re-open this issue if you're unable to get the npm installer to work as a non-root user.

@xortive xortive closed this as completed Feb 25, 2021
@emt-mocha
Copy link

Hi,
I managed to solve the permission issue with ubuntu by doing the followings at below:

  1. Open terminal and paste the following codes.
    mkdir "${HOME}/.npm-packages"
    npm config set prefix "${HOME}/.npm-packages"

  2. Use nano editor
    nano ~/.bashrc

  3. Paste the following codes at the bottom => .bashrc
    NPM_PACKAGES="${HOME}/.npm-packages"
    export PATH="$PATH:$NPM_PACKAGES/bin"
    export MANPATH="${MANPATH-$(manpath)}:$NPM_PACKAGES/share/man"

  4. Finally
    source ~/.bashrc
    npm install -g @cloudflare/wrangler

Hope this helps. Happy coding....

@garikaib
Copy link

garikaib commented May 3, 2022

Solved this by simply using yarn instead of npm.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
onboarding Issues with installation or login
Projects
None yet
Development

No branches or pull requests

10 participants