mozilla / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
174 stars 276 forks source link

Brackets won't load -- PathUtils is undefined #604

Open O-kasso opened 7 years ago

O-kasso commented 7 years ago

When attempting to load the editor either as part of Thimble, or directly at http://localhost:8000/src/hosted.html, get this exception:

Uncaught TypeError: Cannot read property 'directory' of undefined
    at Object.<anonymous> (:8000/src/utils/BrambleExtensionLoader.js:14)
    at Object.execCb (require.min.js:29)
    at Z.check (require.min.js:18)
    at Z.enable (require.min.js:23)
    at Z.init (require.min.js:17)
    at E (require.min.js:14)
    at Object.completeLoad (require.min.js:28)
    at HTMLScriptElement.onScriptLoad (require.min.js:29)

Undefined here should be PathUtils from thirdparty/path-utils/path-utils

My master branch and all submodules are synced with upstream at time of writing, and I performed the necessary npm install and npm start. Also tried troubleshooting steps found here. I've tried nuking and recloning to no avail :(

cc @humphd @gideonthomas

O-kasso commented 7 years ago

chat logs found here: https://chat.mozillafoundation.org/mozilla/pl/neuo67r5x7y6pj71c95ujkqniy

humphd commented 7 years ago

cc @Pomax

I spent a bunch of time on this with @O-kasso today, and I couldn't make any sense of it. I'll try again tomorrow, but I'd appreciate any help people could give here. Something doesn't make sense, and I suspect the environment, a tooling version issue, or something else like that.

The line that's throwing here is this:

https://github.com/mozilla/brackets/blob/master/src/utils/BrambleExtensionLoader.js#L12-L14

When I updated to Adobe's latest upstream code, we pulled in changes that altered the way the PathUtils module gets done, in particular, requiring a submodule change. When I first talked with @O-kasso, it was odd because the version of the submodule was not what it should have been, as though git was at fault somehow. Manually fixing it didn't seem to alter things, nor did a fresh clone. All of this leads me to conclude that there is something in the the environment vs. code, but I'm not sure what.

Pomax commented 7 years ago

hm, I don't run into this myself on the latest commit (2888cfb)... did you two try a "clone --recursive" in a different dir, with "git submodule update --init --recursive" after cloning, followed by npm install? I noticed gyp complaining about python 3 but that's apparently completely inconsequential, npm run build and npm start still work

O-kasso commented 7 years ago

Finally fixed it! Not really sure how I got into this scenario, but this fixed it for me:

git submodule update --init --recursive
git submodule foreach --recursive git fetch
git submodule foreach git merge origin master

What's confusing me is that path-utils isn't even one of the submodules that changed:

    modified:   src/bramble/thirdparty/EventEmitter (new commits)
    modified:   src/extensions/default/JSLint/thirdparty/jslint (new commits)
    modified:   src/extensions/default/brackets-paste-and-indent (new commits)
O-kasso commented 7 years ago

@humphd should I close this issue?

humphd commented 7 years ago

The only new thing here is the inclusion of --recursive in your git submodule update invocation. I notice that this seemed to trigger src/extensions/default/brackets-paste-and-indent to get touched.

I think we should use this as an opportunity to update the README to include a section on how to update your tree:

# Pull new commits from Mozilla (assuming your mozilla/brackets repo is named 'upstream')
git checkout master
git pull upstream master
# Brackets uses a lot of submodules, make sure they are all there and up-to-date
git submodule update --init --recursive
# Deal with any new modules in Brackets or extensions
npm install
# Rebuild dist/* and dist/bramble.js (Bramble Client API)
npm run build

@O-kasso would you be willing to do that?

O-kasso commented 7 years ago

@humphd sure thing, will update tonight

Pomax commented 7 years ago

Note that git submodule foreach git merge origin master technically makes you get different things than what brackets actually needs, by forcing the code into a state more recent than the versions pegged by the submodule entries, so your files might not actually reflect what the code is supposed to be now =)

(worst case, a submodule's master is a major version ahead of what brackets expected, and this introduces a new issue that prevents brackets from loading properly)

O-kasso commented 7 years ago

README update can be found here: https://github.com/mozilla/brackets/pull/610