Skip to content

Commit

Permalink
error-message: more detailed message for inaccessible files. (npm#18384)
Browse files Browse the repository at this point in the history
PR-URL: npm#18384
Credit: @chrisjpatty
Reviewed-By: @zkat
  • Loading branch information
Christopher Patty authored and zkat committed Mar 8, 2018
1 parent 7a87051 commit 9847c82
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/utils/error-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@ function errorMessage (er) {
case 'EACCES':
case 'EPERM':
short.push(['', er])
detail.push(['', ['\nPlease try running this command again as root/Administrator.'
].join('\n')])
detail.push([
'',
[
'\nThe operation was rejected by your operating system.',
(process.platform === 'win32'
? 'It\'s possible that the file was already in use (by a text editor or antivirus),\nor that you lack permissions to access it.'
: 'It is likely you do not have the permissions to access this file as the current user'),
'\nIf you believe this might be a permissions issue, please double-check the',
'permissions of the file and its containing directories, or try running',
'the command again as root/Administrator (though this is not recommended).'
].join('\n')])
break

case 'ELIFECYCLE':
Expand Down

0 comments on commit 9847c82

Please sign in to comment.