contentacms / contenta_ionic

An example Ionic Framework demo using Contenta CMS as a backend.
GNU General Public License v2.0
8 stars 5 forks source link

"npm install -g ionic@latest" required sudo #1

Closed GustavoMarcante closed 7 years ago

GustavoMarcante commented 7 years ago

Hi. I followed the instructions to install contenta_ionic and I got an error trying to install ionic in step 4:

npm ERR! Linux 4.4.0-83-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "ionic@latest"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /opt/drupal/contenta_ionic/npm-debug.log

The error could be fixed using sudo npm install -g ionic@latest

I suggest update README.md. I don't know if I can ask this using something like a pull request, so I opened this issue.

After that, it installed perfectly... And it is beautiful!

dawehner commented 7 years ago

This is interesting. At least under MacOSX npm -g means to install it in your homefolder instead.

It turns out this is actually configurable: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md ... so maybe instead of updating the README for using sudo we should recommend to not install it globally like this?

mortenson commented 7 years ago

Thanks for the report! I've updated the docs to use sudo, that way it's installed globally and users can make/build/serve their own ionic projects elsewhere. The ionic npm package has "preferGlobal" set to true, which means it warns users if installed locally, plus there are possible dependency conflicts since the latest ionic cli requires the latest versions of angular and rxjs.