Skip to content

Commit

Permalink
fix: add warning to yarn install permissions error (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasPhilCo committed Oct 13, 2020
1 parent 82f8434 commit a41f8c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dependencies": {
"@oclif/color": "^0.x",
"@oclif/command": "^1.5.12",
"@oclif/errors": "^1.2.2",
"chalk": "^2.4.2",
"cli-ux": "^5.2.1",
"debug": "^4.1.0",
Expand All @@ -21,7 +22,6 @@
"devDependencies": {
"@oclif/config": "^1.12.11",
"@oclif/dev-cli": "^1.21.3",
"@oclif/errors": "^1.2.2",
"@oclif/plugin-help": "^3.1.0",
"@oclif/test": "^1.2.4",
"@types/chai": "^4.1.7",
Expand Down
9 changes: 9 additions & 0 deletions src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ export default class Plugins {
return plugin
} catch (error) {
await this.uninstall(name).catch(error => this.debug(error))

if (String(error).includes('EACCES')) {
throw new CLIError(error, {
suggestions: [
`Plugin failed to install because of a permissions error.\nDoes your current user own the directory ${this.config.dataDir}?`,
],
})
}

throw error
}
}
Expand Down

0 comments on commit a41f8c2

Please sign in to comment.