Closed
Bug 1218748
Opened 9 years ago
Closed 9 years ago
On some OSes the Mozilla eslint plugin requires sudo
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: miker, Assigned: miker)
References
Details
At the moment it looks like everything installs fine on Linux when the installs are actually failing due to permissions issues. We should add some simple logic: if (linux or osx) and !sudo: print "Sudo required" return False
Assignee | ||
Comment 1•9 years ago
|
||
Some modules (such as eslint) need to be installed as root. This is because they create symlinks in /user/bin/.
Assignee | ||
Comment 2•9 years ago
|
||
npm install eslint -g: Error: permission denied, unlink '/usr/bin/eslint' cd testing/eslint-plugin-mozilla/ npm link Error: permission denied, unlink '/usr/lib/node_modules/eslint-plugin-mozilla' npm install eslint-plugin-react -g Error: permission denied, rmdir '/usr/lib/node_modules/eslint-plugin-react' But it turns out that some users have changed permissions to work around this node issue so forcing sudo on them may not be required. If we base this on bug 1212047 then we can simply display the following when the command fails: "Installation of blah must be run by root/Administrator on some systems. Please rerun mach blah as root/Administrator"
Depends on: 1212047
Comment 3•9 years ago
|
||
I applied the patch on mach_commands at bug 1212047 and finished without errors [1], but I keep getting "Error: Cannot find module 'eslint-plugin-mozilla'" [2] when try to commit something in a gaia repo. [1] mozillas-MacBook-Pro:gecko-b2g-desktop anatal$ sudo ./mach eslint --setup Password: Installing eslint using "/usr/local/bin/npm install eslint -g"... | Installing eslint-plugin-mozilla using "/usr/local/bin/npm link"... Installing eslint-plugin-react using "/usr/local/bin/npm install eslint-plugin-react -g"... ESLint and approved plugins installed successfully! [2] mozillas-MacBook-Pro:gaia anatal$ git commit -a jshint check: 0 errors eslint check: module.js:338 throw err; ^ Error: Cannot find module 'eslint-plugin-mozilla' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at /Users/anatal/projects/mozilla/gecko-b2g-desktop/gaia/node_modules/eslint/lib/cli-engine.js:116:26 at Array.forEach (native) at loadPlugins (/Users/anatal/projects/mozilla/gecko-b2g-desktop/gaia/node_modules/eslint/lib/cli-engine.js:107:21) at processText (/Users/anatal/projects/mozilla/gecko-b2g-desktop/gaia/node_modules/eslint/lib/cli-engine.js:194:5) at processFile (/Users/anatal/projects/mozilla/gecko-b2g-desktop/gaia/node_modules/eslint/lib/cli-engine.js:254:18) at executeOnFile (/Users/anatal/projects/mozilla/gecko-b2g-desktop/gaia/node_modules/eslint/lib/cli-engine.js:540:23) There were errors while linting the files, please see above. Please read https://github.com/mozilla-b2g/gaia/tree/master/build/eslint/README.md for more information.\n
Comment 4•9 years ago
|
||
Michael, do you have any idea what should I do on this case?
Flags: needinfo?(mratcliffe)
Comment 5•9 years ago
|
||
Just an additional info: This problem happens only on gaia repos set for test-integration, i.e., where we executed: make test-integration. I cloned a fresh one and after run 'make' and 'npm install' in 'gaia/', the lint occurs correctly.
Assignee | ||
Comment 6•9 years ago
|
||
(In reply to Andre Natal from comment #5) > Just an additional info: This problem happens only on gaia repos set for > test-integration, i.e., where we executed: make test-integration. > > I cloned a fresh one and after run 'make' and 'npm install' in 'gaia/', the > lint occurs correctly. Interesting... this should really not have any influence on eslint modules and it is strange that on failure npm fails to return an error code (hence us not detecting that it is broken). In a build where it won't install can you run the following and let me know the output: sudo install eslint -g cd testing/eslint-plugin-mozilla # from project root sudo npm link cd ../.. # back to project root sudo npm install eslint-plugin-react -g
Flags: needinfo?(mratcliffe)
Assignee | ||
Comment 7•9 years ago
|
||
Can you try again with the latest version and report any errors?
Assignee | ||
Comment 8•9 years ago
|
||
This was fixed by bug 1212047 where the error message would say to use an admin / superuser.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Comment 9•9 years ago
|
||
Yes, this is working for me too.
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•