Closed Bug 1408392 Opened 3 years ago Closed 2 years ago

Cannot install eslint locally on Windows

Categories

(Firefox Build System :: Lint and Formatting, defect, P5)

3 Branch
x86_64
Windows 10
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: emk, Unassigned)

Details

Attachments

(1 file)

I got he following error when I tried:

$ mach eslint
eslint-plugin-react v7.1.0 needs to be installed locally.
eslint-plugin-no-unsanitized v2.0.1 needs to be installed locally.
eslint-plugin-spidermonkey-js vfile:tools/lint/eslint/eslint-plugin-spidermonkey-js needs to be installed locally.
sax v1.2.4 needs to be installed locally.
eslint-plugin-mozilla vfile:tools/lint/eslint/eslint-plugin-mozilla needs to be installed locally.
ini-parser v0.0.2 needs to be installed locally.
Installing eslint for mach using "d:\mozilla-build\node-v8.1.4-win-x64\npm.cmd install --loglevel=error"...
npm ERR! code EINVAL
npm ERR! EINVAL: invalid argument, read

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\kimu\AppData\Roaming\npm-cache\_logs\2017-10-13T12_49_21_912Z-debug.log

Error installing eslint, aborting.
Could not find eslint!  We looked at the --binary option, at the ESLINT
environment variable, and then at your local node_modules path. Please Install
eslint and needed plugins with:

mach eslint --setup

and try again.
A failure occured in the eslint linter.
? 1 problem (0 errors, 0 warnings, 1 failure)
End of the log:
1886 silly unbuild eslint@3.19.0
1887 info lifecycle eslint@3.19.0~preuninstall: eslint@3.19.0
1888 info lifecycle eslint@3.19.0~uninstall: eslint@3.19.0
1889 verbose unbuild rmStuff eslint@3.19.0 from f:\m\mozilla-unified\node_modules
1890 verbose unlock done using C:\Users\kimu\AppData\Roaming\npm-cache\_locks\staging-c8588b05fa5416d5.lock for f:\m\mozilla-unified\node_modules\.staging
1891 verbose stack Error
1891 verbose stack     at d:\mozilla-build\node-v8.1.4-win-x64\node_modules\npm\lib\utils\gently-rm.js:275:7
1891 verbose stack     at d:\mozilla-build\node-v8.1.4-win-x64\node_modules\iferr\index.js:13:50
1891 verbose stack     at d:\mozilla-build\node-v8.1.4-win-x64\node_modules\graceful-fs\polyfills.js:287:18
1891 verbose stack     at FSReqWrap.oncomplete (fs.js:153:5)

gently-rm.js:275:7 is here:
      readCmdShim(path, function (er, source) {
Are you using a symlink for mach? Could you try it in the top-level source directory with:

./mach eslint

?

I'm wondering if this might be bug 1274604 in a different form.

The other options would be to:

- try removing the node_modules directory in your top-level source directory, and then re-running. 
- run `npm install` direct in the top-level source directory.
Flags: needinfo?(VYV03354)
(In reply to Mark Banner (:standard8) from comment #2)
> Are you using a symlink for mach?

No, Windows has the current directory in PATH.

> Could you try it in the top-level source
> directory with:
> 
> ./mach eslint
> 
> ?

I got the same result.

> I'm wondering if this might be bug 1274604 in a different form.
> 
> The other options would be to:
> 
> - try removing the node_modules directory in your top-level source
> directory, and then re-running. 

Again, I got the same result. The node_modules directory was recreated.

> - run `npm install` direct in the top-level source directory.

I got the same error from npm:
npm ERR! code EINVAL
npm ERR! EINVAL: invalid argument, read

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\kimu\AppData\Roaming\npm-cache\_logs\2017-10-13T14_08_32_088Z-debug.log

The log content was mostly the same as comment #1.
Flags: needinfo?(VYV03354)
I patched read-cmd-shim to continue.

Next, I got following errors:
npm ERR! EISDIR: illegal operation on a directory, symlink 'f:\m\mozilla-unified\tools\lint\eslint\eslint-plugin-mozilla' -> 'f:\m\mozilla-unified\node_modules\eslint-plugin-mozilla'

npm ERR! EISDIR: illegal operation on a directory, symlink 'f:\m\mozilla-unified\tools\lint\eslint\eslint-plugin-spidermonkey-js' -> 'f:\m\mozilla-unified\node_modules\eslint-plugin-spidermonkey-js'

My f:\ is an exFAT volume, so I could not even create links (junctions) manually.
I copied mylocal tree to an NTFS volume, and finally it works!
Priority: -- → P5
Product: Testing → Firefox Build System
Masatoshi: is this still an issue now without the patched read-cmd-shim?

Recent changes mean we install node into .mozbuild (if you run ./mach bootstrap), so hopefully it sets everything up correctly.
Flags: needinfo?(VYV03354)
Apparently it is working.

$ mach eslint --setup

$ mach eslint
e:\m\mozilla-unified\browser\components\urlbar\UrlbarProviderOpenTabs.jsm
  133:6  error  Unexpected @returns tag; function has no return statement.  valid-jsdoc (eslint)

e:\m\mozilla-unified\devtools\client\responsive.html\components\DeviceModal.js
  37:9  error  Do not mutate state directly. Use setState().  react/no-direct-mutation-state (eslint)

? 2 problems (2 errors, 0 warnings)

$
Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(VYV03354)
Resolution: --- → WORKSFORME
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.