ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
803 stars 54 forks source link

webpack plugin fails with an exception after loading at autocomplete resolution #156

Closed AlejandroBlanco closed 7 years ago

AlejandroBlanco commented 7 years ago

there's a conflict somewhere that prevents the webpack plugin from autocompleting. I'm using last ST3 version as of 23/12/2016 and the last version available in the master branch of ternjs-sublime

This is my .tern-project file:

{ "libs": [ "browser", "ecmascript", "jquery", "underscore", "chai" ], "plugins": { "requirejs": {}, "modules": {}, "es_modules": {}, "commonjs": {}, "complete_strings": {}, "node_resolve": {}, "node": {}, "webpack": {} } }

An this is the exception I get:

webpackpluginbug

marijnh commented 7 years ago

Looks like a missing or damaged dependency library. I just forced a reinstall of enhanced-resolve, and the file that being named in your error message is there. Maybe try deleting the node_modules subdir of your Tern install and reinstalling with npm install?

AlejandroBlanco commented 7 years ago

reinstalling enharced-resolve misses that module. I'm using npm install enhanced-resolve after removing all node-modules folder

marijnh commented 7 years ago

Strange. Which version of enhanced-resolve did you get? I got 2.3.0, which does have the file.

AlejandroBlanco commented 7 years ago

webpack/enhanced-resolve v3.x.x misses that file. Looks like I should be using v2.3.0 at most. By default v3 is installed

AlejandroBlanco commented 7 years ago

Good timing. FYI I'm installing using: npm install with latest ternjs-sublime version on master. npm install enhanced-resolve; npm install makes no difference obviously. I'll force the installation of enhanced-resolve v2.3.0

marijnh commented 7 years ago

Well, Tern's package.json specifies its enhanced-resolve dependency as "^2.2.2", which 3.x.x doesn't match, so I'm wondering why NPM is installing a non-matching version of a dependency.

AlejandroBlanco commented 7 years ago

C:\blabla\Sublime Text 3\Packages\tern_for_sublime [master ≡ +0 ~1 -0 !]> npm install enhanced-resolve@2.3.0 does the trick. What about the package.json in ternjs-sublime? Does it overwrite the deps from standalone tern? Does: "enhanced-resolve": "^2.2.2", mean that it will install at least 2.2.2, trying to install the last one?

AlejandroBlanco commented 7 years ago

In any case, the versions of the deps installed to me look random:

C:\blabla\Sublime Text 3\Packages\tern_for_sublime [master ≡ +0 ~1 -0 !]> npm install npm http GET https://registry.npmjs.org/tern npm http 304 https://registry.npmjs.org/tern npm http GET https://registry.npmjs.org/acorn npm http GET https://registry.npmjs.org/glob npm http GET https://registry.npmjs.org/minimatch npm http GET https://registry.npmjs.org/resolve-from/2.0.0 npm http 304 https://registry.npmjs.org/acorn npm http 304 https://registry.npmjs.org/glob npm http 304 https://registry.npmjs.org/minimatch npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp D oS issue npm http 304 https://registry.npmjs.org/resolve-from/2.0.0 npm http GET https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz npm http 200 https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz npm http GET https://registry.npmjs.org/lru-cache npm http GET https://registry.npmjs.org/sigmund npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp Do S issue npm http 304 https://registry.npmjs.org/lru-cache npm http 304 https://registry.npmjs.org/sigmund tern@0.20.0 node_modules\tern ├── resolve-from@2.0.0 ├── minimatch@0.2.14 (sigmund@1.0.1, lru-cache@2.7.3) ├── glob@3.2.11 (inherits@2.0.3, minimatch@0.3.0) └── acorn@4.0.4

AlejandroBlanco commented 7 years ago

So, I'm being pointed to tern v0.20.0. I'm not getting what is in master

AlejandroBlanco commented 7 years ago

Yep.

{ "name": "tern_for_sublime", "license": "MIT", "version": "0.4.0", "author": "Marijn Haverbeke marijnh@gmail.com", "description": "Sublime Text package for Tern", "repository": { "type": "git", "url": "git://github.com/ternjs/tern_for_sublime.git" }, "dependencies": { "tern": ">=0.5" } }

will retrieve tern v0.20.0, which is wrong. Then it will proceed to install outdated deps

AlejandroBlanco commented 7 years ago

npm@4.1.1 C:\Users\Alex\AppData\Roaming\npm\node_modules\npm

PS C:\blabla\Sublime Text 3\Packages\tern_for_sublime> node -v v6.9.2 PS C:\blabla\Sublime Text 3\Packages\tern_for_sublime>

I need to install manually tern before tern_for_sublime like:

PS C:\blabla\Sublime Text 3\Packages\tern_for_sublime> npm install "https://github.com/ternjs/tern.git#master" tern_for_sublime@0.4.0 C:\blabla\Sublime Text 3\Packages\tern_for_sublime

`-- tern@0.20.0  (git+https://github.com/ternjs/tern.git#b26e513f7bb8c7bb3509b7ce7066212673cef285)
  +-- acorn@3.3.0
  +-- enhanced-resolve@2.3.0
  | +-- graceful-fs@4.1.11
  | +-- memory-fs@0.3.0
  | | +-- errno@0.1.4
  | | | `-- prr@0.0.0
  | | `-- readable-stream@2.2.2
  | |   +-- buffer-shims@1.0.0
  | |   +-- core-util-is@1.0.2
  | |   +-- isarray@1.0.0
  | |   +-- process-nextick-args@1.0.7
  | |   +-- string_decoder@0.10.31
  | |   `-- util-deprecate@1.0.2
  | +-- object-assign@4.1.0
  | `-- tapable@0.2.5
  +-- glob@7.1.1
  | +-- fs.realpath@1.0.0
  | +-- inflight@1.0.6
  | | `-- wrappy@1.0.2
  | +-- inherits@2.0.3
  | +-- once@1.4.0
  | `-- path-is-absolute@1.0.1
  +-- minimatch@3.0.3
  | `-- brace-expansion@1.1.6
  |   +-- balanced-match@0.4.2
  |   `-- concat-map@0.0.1
  `-- resolve-from@2.0.0

If I try to download tern via a simple npm install, npm will get:

PS C:\blabla\Sublime Text 3\Packages\tern_for_sublime> npm install npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue tern_for_sublime@0.4.0 C:\blabla\Sublime Text 3\Packages\tern_for_sublime

`-- tern@0.20.0
  +-- acorn@3.3.0
  +-- enhanced-resolve@2.3.0
  | +-- graceful-fs@4.1.11
  | +-- memory-fs@0.3.0
  | | +-- errno@0.1.4
  | | | `-- prr@0.0.0
  | | `-- readable-stream@2.2.2
  | |   +-- buffer-shims@1.0.0
  | |   +-- core-util-is@1.0.2
  | |   +-- isarray@1.0.0
  | |   +-- process-nextick-args@1.0.7
  | |   +-- string_decoder@0.10.31
  | |   `-- util-deprecate@1.0.2
  | +-- object-assign@4.1.0
  | `-- tapable@0.2.5
  +-- glob@3.2.11
  | +-- inherits@2.0.3
  | `-- minimatch@0.3.0
  +-- minimatch@0.2.14
  | +-- lru-cache@2.7.3
  | `-- sigmund@1.0.1
  `-- resolve-from@2.0.0

Notice different deps and warnings. In both cases it says I'm DL 0.20.0 even when master is not 0.20.0.

It is working now. I believe the problem was with an outdated version of npm. Both cases (deps from 0.20.0 and deps from master) work properly. I'll keep tern 0.20.0 in favor of stability. Thanks. Happy Saturnalias

marijnh commented 7 years ago

will retrieve tern v0.20.0, which is wrong. Then it will proceed to install outdated deps

Why is this wrong? 0.20.0 is the current release. And the install output you show all mentions enhanced-resolve@2.3.0, which should work.

AlejandroBlanco commented 7 years ago

Forget that line. My bad. 0.20.0 deps are good as they are. What I was retrieving from npm were deps even older than 0.20.0. Problem was an old version of npm doing funny unexpected things. Seemed like it was working normally but old versions can mess with dependency versioning. I'm closing this issue.