diff --git a/package.json b/package.json index 44b5e73b..a6833a3e 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/src/plugins.ts b/src/plugins.ts index a9393ab6..e8273971 100644 --- a/src/plugins.ts +++ b/src/plugins.ts @@ -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 } }