Truffle: `npm install truffle -g` doesn't work on Mac for 4.1.x versions

Created on 25 Apr 2018  Â·  15Comments  Â·  Source: trufflesuite/truffle

  • [ x] I've asked for help in the Truffle Gitter before filing this issue.

Truffle NPM Module doesn't install properly on a Mac OS

Truffle npm module 4.1.x versions does not install properly on a Mac OS.

Steps to Reproduce

  1. Be on a Mac OS. My particular machine is Mac OS High Sierra 10.13.4, but I was experiencing this issue before I upgraded to High Sierra.
  2. Open up terminal and execute npm install truffle -g

Expected Behavior

It should install without error.

Actual Results

➜  ~ npm i truffle -g
npm ERR! path /usr/local/lib/node_modules/truffle/build/cli.bundled.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open '/usr/local/lib/node_modules/truffle/build/cli.bundled.js'
npm ERR!  { Error: EACCES: permission denied, open '/usr/local/lib/node_modules/truffle/build/cli.bundled.js'
npm ERR!   cause:
npm ERR!    { Error: EACCES: permission denied, open '/usr/local/lib/node_modules/truffle/build/cli.bundled.js'
npm ERR!      errno: -13,
npm ERR!      code: 'EACCES',
npm ERR!      syscall: 'open',
npm ERR!      path: '/usr/local/lib/node_modules/truffle/build/cli.bundled.js' },
npm ERR!   stack: 'Error: EACCES: permission denied, open \'/usr/local/lib/node_modules/truffle/build/cli.bundled.js\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path: '/usr/local/lib/node_modules/truffle/build/cli.bundled.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/admin/.npm/_logs/2018-04-25T18_53_07_022Z-debug.log

Environment

  • Operating System: Mac OS
  • Ethereum client:
  • Truffle version (truffle version): 4.1.x
  • node version (node --version): 8.11.1 (also tried using 10.x and 7.x) with no luck
  • npm version (npm --version): 5.6.0

Further Steps Taken to Resolve this issue

  • Installing with sudo does not work
  • Changing permission on global node_modules folder does not work (already has proper permissions
  • npm install [email protected] works and is the last version that does not throw the error.

Possible Causes

  • Some change in the package.json or installation process that occurred from the tag 4.0.7 to 4.1.x

Most helpful comment

@cgewecke I figured out the issue. There was some antivirus software that was blocking access to some directories in our local. You can close this issue.

All 15 comments

@Superjisan. I'm also on OSX. Below is my output for installing. Can you find a difference we can test against?

> system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 10.13.1 (17B1003)
      Kernel Version: Darwin 17.2.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: User’s MacBook Air
      User Name: User (cgewecke)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 2:04

> npm --version
5.6.0
> node --version
v9.5.0
> npm uninstall -g truffle
removed 1 package in 4.561s
> npm install -g truffle
/Users/cgewecke/.nvm/versions/node/v9.5.0/bin/truffle -> /Users/cgewecke/.nvm/versions/node/v9.5.0/lib/node_modules/truffle/build/cli.bundled.js
+ [email protected]
added 92 packages in 8.162s

@cgewecke that is strange. here's my system info

system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 10.13.4 (17E199)
      Kernel Version: Darwin 17.5.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: test’s MacBook Pro
      User Name: Admin (admin)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 23:26

Also just tried with v.9.5.0 and same issue. How do you have your node versions install @cgewecke ?

Kernel and System Versions are different. But I wonder why that would cause the issue

I also have this issue and this is what my system_profiler outputs:

System Software Overview:

  System Version: macOS 10.12.3 (16D32)
  Kernel Version: Darwin 16.4.0
  Boot Volume: Macintosh HD
  Boot Mode: Normal
  Computer Name: Joe’s MacBook Pro
  User Name: Joe N (joen)
  Secure Virtual Memory: Enabled
  System Integrity Protection: Enabled
  Time since boot: 35 days 1:06

@Superjisan I'm using a node version manager called nvm because Truffle is built for 6.9.1 and sometimes it's helpful to toggle down and make sure everything works.

  • How are you installing? From node?
  • when did you install Node?

One thing that occurs to me is that if this problem had begun with 4.0.7 we would have had dozens of reports since then, but yours is the first. Perhaps something has changed outside truffle more recently that's causing it. Based on the sample of OS data above doesn't seem like there's much of pattern there. . .

@Joebob12 Anything else you can add might help isolate the cause of this, thanks!

@cgewecke I've actually tried installing using brew, nvm, and just standalone from the website and so far no luck.

I'll dig around more...

@cgewecke it worked using 6.9.0 just now.

@Superjisan Oh, that's strange. Node should be backward compatible to any version . . .

@collincusce Are you also seeing this installation problem? Trying to figure out how widespread this is.

Nah, @superjisan is on my team so I'm monitoring the progress on this.

@Superjisan Did this ever work itself out?

@cgewecke I guess I have figured out a workaround with using a 6.9.0 version of node but it doesn't work on my computers with versions above that with the latest truffle versions.

@cgewecke I figured out the issue. There was some antivirus software that was blocking access to some directories in our local. You can close this issue.

Ah awesome!! Thanks @Superjisan.

@Superjisan I have the same issue! May I ask how you managed to close the antivirus software?

@mhlljm I had to disable the antivirus software from my computer to get it to work. You might need to talk to your IT department if you require a password or something

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timothywangdev picture timothywangdev  Â·  3Comments

maximilianh picture maximilianh  Â·  3Comments

tcurdt picture tcurdt  Â·  3Comments

ysfAskri picture ysfAskri  Â·  4Comments

abcoathup picture abcoathup  Â·  3Comments