Skip to content

Commit a41f8c2

Browse files
authored
fix: add warning to yarn install permissions error (#183)
1 parent 82f8434 commit a41f8c2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"dependencies": {
88
"@oclif/color": "^0.x",
99
"@oclif/command": "^1.5.12",
10+
"@oclif/errors": "^1.2.2",
1011
"chalk": "^2.4.2",
1112
"cli-ux": "^5.2.1",
1213
"debug": "^4.1.0",
@@ -21,7 +22,6 @@
2122
"devDependencies": {
2223
"@oclif/config": "^1.12.11",
2324
"@oclif/dev-cli": "^1.21.3",
24-
"@oclif/errors": "^1.2.2",
2525
"@oclif/plugin-help": "^3.1.0",
2626
"@oclif/test": "^1.2.4",
2727
"@types/chai": "^4.1.7",

src/plugins.ts

+9
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ export default class Plugins {
8484
return plugin
8585
} catch (error) {
8686
await this.uninstall(name).catch(error => this.debug(error))
87+
88+
if (String(error).includes('EACCES')) {
89+
throw new CLIError(error, {
90+
suggestions: [
91+
`Plugin failed to install because of a permissions error.\nDoes your current user own the directory ${this.config.dataDir}?`,
92+
],
93+
})
94+
}
95+
8796
throw error
8897
}
8998
}

0 commit comments

Comments
 (0)