jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.54k stars 4.02k forks source link

Write access error while using jhipster:upgrade #4033

Closed ashakhov closed 8 years ago

ashakhov commented 8 years ago
Overview of the issue

During project upgrade JHipster is trying to update itself. System-wide installation of NodeJS keeps all its modules in /usr/lib/node_modules/ and you can install something globally only as root or via sudo. So the upgrader fails to write its files and finish its job. Tried to upgrade JH before executing project upgrade. It succeeded to make a commit but then tried to install actual version of JH and failed. sudo yo jhipster:upgrade failed as well.

Reproduce the error
$ yo jhipster:upgrade
Welcome to the JHipster Upgrade Sub-Generator 
This will upgrade your current application codebase to the latest JHipster version
Looking for latest generator-jhipster version...
New generator-jhipster version found: 3.6.1
Git repository detected
Updating generator-jhipster. This might take some time...
Error jhipster:upgrade 

ERROR! Something went wrong while updating generator! /usr/lib
└── generator-jhipster@3.6.1 

 npm WARN deprecated cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN checkPermissions Missing write access to /usr/lib/node_modules/generator-jhipster
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! Linux 4.4.0-34-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "generator-jhipster"
npm ERR! node v4.5.0
npm ERR! npm  v3.10.6
npm ERR! path /usr/lib/node_modules/generator-jhipster
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

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

JHipster 3.6.1 (trying to update project generated by 3.5.1)

git version 1.9.1 node: v4.5.0 npm: 3.10.6 bower: 1.7.9 gulp: [12:44:09] CLI version 3.9.1 [12:44:09] Local version 3.9.1 yeoman: 1.8.4

Browsers and Operating System

Ubuntu 14.04.5, regular non-root user with sudo rights, system-wide installed nodejs from official NodeJS repo.

jdubois commented 8 years ago

Looks like you don't have the right permissions, have you tried:

https://docs.npmjs.com/getting-started/fixing-npm-permissions

ashakhov commented 8 years ago

Yes, it worked with npm global folder moved from /usr/lib/node_modules to home folder. It doesn't look like the best solution since it locks system-wide libs to single user but it's more like a npm architecture issue that can not be overridden in JH. Maybe it will be better to note it on the JHipster Installation page?

gmarziou commented 8 years ago

Best is to use a node version manager like nvm on Linux and OSX or nodist on Windows. This way you don't have to be sudoer and can switch versions in a snap.

ashakhov commented 8 years ago

But it's not a %distribname%-way since every Linux distro has its own package manager that was meant to be used! :) Sorry, now it's more like a religious dispute. Seems like this issue can be closed since everyone can google this problem and find an answer in these comments.

gmarziou commented 1 year ago

@miguelk5 please don´t comment on old closed issues. You may have encountered an issue that looks similar but 7 years later, it does not make sense. Please open a new issues with all requested details.