Wrangler: npm install fails

Created on 29 Sep 2019  路  6Comments  路  Source: cloudflare/wrangler

馃悰 Bug Report

Environment

  • operating system: Ubuntu 18.04 WSL 4.4.0-18985-Microsoft (Windows 10 amd64)
  • output of rustc -V: rustc 1.36.0
  • output of node -v: v11.15.0
  • output of wrangler -V: N/A

npm version: 6.7.0

Steps to reproduce

sudo npm i @cloudflare/wrangler -g

What did you expect to see?

install the wrangler package

What did you see instead?

/usr/bin/wrangler -> /usr/lib/node_modules/@cloudflare/wrangler/run-wrangler.js

@cloudflare/[email protected] postinstall /usr/lib/node_modules/@cloudflare/wrangler
node install-wrangler.js

fs.js:119
throw err;
^

Error: EACCES: permission denied, mkdir '/home/mxdpeep/.wrangler'
at mkdirSync (fs.js:773:3)
at Object. (/usr/lib/node_modules/@cloudflare/wrangler/install-wrangler.js:58:3)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
at internal/main/run_main_module.js:21:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @cloudflare/[email protected] postinstall: node install-wrangler.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @cloudflare/[email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

user report

Most helpful comment

yes thanks @EverlastingBugstopper
again it is the FIRST time I have encountered that with any package in serveral years.
It does not raise MY confidence with this tool

All 6 comments

BTW cargo build works

image

hey @mxdpeep ! based on the install command you are running (sudo npm i @cloudflare/wrangler -g) it looks like you do not have node installed with a node version manager like n, nvm, or nodist.

if you've installed node without a tool like this, your npm global cache (which npm i -g uses) is in the root directory of your machine and requires root perms to modify.

we recommend using a node version manager, because these tools will install and keep node and it's global cache in your user directory, which won't require these perms. cargo does this by default (which is why the cargo install works.)

if you'd like to use the npm installer, we recommend you reinstall node using a version manager!

it is a correct installation of node.js from the official site

@ashleygwilliams
this is the first flipp'n package that seriously required to have node installed in userspace.
it should not require that!

Hey y'all! Thanks for commenting on this and I'm sorry that this is causing so much trouble!

Unfortunately this is actually a fairly common problem with global installs from npm. So much so that they have their own reference page! https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

I'd recommend following along there and hopefully that will help work through some of the pain points here.

yes thanks @EverlastingBugstopper
again it is the FIRST time I have encountered that with any package in serveral years.
It does not raise MY confidence with this tool

Was this page helpful?
0 / 5 - 0 ratings