atom-typescript icon indicating copy to clipboard operation
atom-typescript copied to clipboard

Failed to load the atom-typescript package

Open yuitakano opened this issue 11 years ago • 23 comments

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.0.4 System: Unknown Windows Version Thrown From: atom-typescript package, v5.2.4

Stack Trace

Failed to load the atom-typescript package

At Cannot find module 'jsdom'

Error: Cannot find module 'jsdom'
    at Module._resolveFilename (module.js:328:15)
    at Function.Module._resolveFilename (C:\Users\a2132_000\AppData\Local\atom\app-1.0.4\resources\app.asar\src\module-cache.js:383:52)
    at Function.Module._load (module.js:270:25)
    at Module.require (module.js:357:17)
    at require (module.js:376:17)
    at Object.<anonymous> (C:\Users\a2132_000\.atom\packages\atom-typescript\node_modules\htmltojsx\src\htmltojsx.js:148:15)
    at Module._compile (module.js:452:26)
    at Object.loadFile [as .js] (C:\Users\a2132_000\AppData\Local\atom\app-1.0.4\resources\app.asar\src\babel.js:163:21)
    at Module.load (module.js:347:32)
    at Function.Module._load (module.js:302:12)

Commands

Config

{
  "core": {
    "projectHome": "D:\\work\\"
  }
}

Installed Packages

# User
.bin, vundefined
angularjs, v0.3.0
angularjs-snippets, v0.10.18
atom-typescript, v5.2.4
editorconfig, v1.0.1
javascript-snippets, v1.0.0
minimap, v4.12.1
run-in-browser, v0.1.3

# Dev
No dev packages

yuitakano avatar Aug 06 '15 08:08 yuitakano

I couldn't install it either.

ericmdantas avatar Aug 06 '15 10:08 ericmdantas

Same here

jarnovanmunster avatar Aug 06 '15 12:08 jarnovanmunster

+1

ghost avatar Aug 06 '15 13:08 ghost

+1

edurdevic avatar Aug 06 '15 13:08 edurdevic

+1

samanthamjohn avatar Aug 06 '15 13:08 samanthamjohn

+1

wmalgadey avatar Aug 06 '15 13:08 wmalgadey

Easy to fix: Just navigate to where the atom-typescript package is installed and install the missing module. npm install --save-dev jsdom

Restart atom and all is well :)

cstefan avatar Aug 06 '15 13:08 cstefan

worked for me!

wmalgadey avatar Aug 06 '15 14:08 wmalgadey

@cstefan How to find out where the atom-typescript package is installed?

akalcik avatar Aug 06 '15 14:08 akalcik

@akalcik on which system did you install atom?

in windows go to

%appdata%

there you find .atom and in there a directory called packages there is the plugin installed

wmalgadey avatar Aug 06 '15 14:08 wmalgadey

@wmalgadey Good question, sorry. Yes I'm on Windows. The %appdata% points to the Roaming profile, there isn't package folder under the atom folder. I went to Local folder under the AppData. There are only three files atom-1.0.4-delta.nupkg,atom-1.0.4-full.nupkg and RELEASES. If I install the jsdom here, new folder is created, but I get the error again.

image

akalcik avatar Aug 06 '15 14:08 akalcik

+1

@akalcik I found it here:

C:\Users[user].atom\packages\atom-typescript

thanks @cstefan. worked for me

mpseidel avatar Aug 06 '15 19:08 mpseidel

FWIW we don't have any calls to require('jsdom') so some package that we are depending on uses it ... but doesn't have it in in package.json.

Investigating

basarat avatar Aug 07 '15 01:08 basarat

I've tracked it back to this line : https://github.com/reactjs/react-magic/blob/d85cf2665282b9b9d71f0ad4637d01deef448f37/src/htmltojsx.js#L148 But it doesn't actually have a depdency on it : https://github.com/reactjs/react-magic/blob/d85cf2665282b9b9d71f0ad4637d01deef448f37/package.json#L10

As a workaround I'll take an explicit dependency on it for now

basarat avatar Aug 07 '15 01:08 basarat

This commit broke it : https://github.com/reactjs/react-magic/commit/064c1f20e9fe15d4ae65ed6091975aee3c02ce56

basarat avatar Aug 07 '15 02:08 basarat

Published with 5.2.6 :rose:

basarat avatar Aug 07 '15 02:08 basarat

Thanks for the quick fix, @basarat!

ericmdantas avatar Aug 07 '15 02:08 ericmdantas

Sorry about that! In HTMLtoJSX I got a pull request to switch from jsdom to jsdom-no-contextify, but it looks like the require statement wasn't updated. Everything still worked when I was testing it, since I still had the old jsdom in my node_modules (I guess npm doesn't clean up unused modules). I'm still learning the ins and outs of npm :smile:. I'll fix this right now.

As an aside, I'd suggest adjusting your dependencies so you depend on particular versions of modules, rather than allowing any newer versions. Not using specific versions means that your builds are not repeatable, and you could potentially be using an untested combination of modules.

Daniel15 avatar Aug 07 '15 03:08 Daniel15

Pushed 0.2.4 of HTMLtoJSX to fix this. Thanks for reporting it!

Daniel15 avatar Aug 07 '15 03:08 Daniel15

+1

rroman81 avatar Aug 13 '15 22:08 rroman81