Giter Club home page Giter Club logo

Comments (7)

ieugen avatar ieugen commented on May 18, 2024

maybe you have corrupted modules? try removing node_modules folder and do npm install again

from blendid.

TexRx avatar TexRx commented on May 18, 2024

After a bit of testing, I determined that this error occurs if I do not have underscore installed as node_module on it's own. If I perform a checkout of this repo, then immediately run npm install, followed by gulp production, the error occurs. It seems very unlikely that these two steps would result in corrupt modules (I also ran npm cache clean before installing this repo). If I run npm install -D underscore, and then run gulp production, the project builds with no errors. On the other hand, if I do not install underscore as it's own module, but instead replace this line in the config.js:

require: ['jquery', 'underscore']

with:

require: ['jquery', 'backbone/node_modules/underscore']

the build completes successfully.

So, am I doing something else wrong with regard to the loading of underscore? Because, for me, it appears that I either need to have underscore installed as it's own module (e.g., do not rely on underscore within backbone module dependencies), or I have to explicitly specify the path to underscore within the backbone dependencies, when specifying the require-ed assets.

I referenced this during my troubleshooting: https://github.com/substack/node-browserify#brequirefile-opts

I should also note that it appears that listing underscore in the browser section of package.json makes no difference. I removed the underscore reference from package.json, and also tried every variation of the backbone > underscore reference that I could think of, and it made no difference. Additionally, I shim-ed underscore in the browserify-shim section, also to no avail.

from blendid.

greypants avatar greypants commented on May 18, 2024

Yeah, I saw this happen to a friend at work, but I couldn't replicate it on my machine. Might have something to do with minor version differences. I'll definitely look into it.

Your require: ['jquery', 'backbone/node_modules/underscore'] solution seems like a good one to me. That whole backbone underscore mess is only in this repo to call out a weird edge case where if you listed underscore as a normal dependency, you'd end up with two copies of underscore in your compiled bundle since Backbone is weird and comes with it.

from blendid.

TexRx avatar TexRx commented on May 18, 2024

Thanks for the reply. I've run my starter kit (which borrows liberally from your examples here - thanks!!!) on several Macs and Windows machines, and everything is cool as long as I use backbone/node_modules/underscore in the require param array, so I'm going to stick with that for now. The main thing is that I know that it works. Thanks again for all your efforts putting your repo together. It has been immensely helpful.

from blendid.

greypants avatar greypants commented on May 18, 2024

👍

from blendid.

greypants avatar greypants commented on May 18, 2024

Was able to reproduce it after upgrading node and npm, killing my node_modules folder and running npm cache clean. Pushed up the fix you suggested with a note linking to this issue. Thanks!

Eventually I need to remove that backbone/underscore example. I think it's more confusing than helpful at this point. Maybe move a note about that edge case into the wiki instead.

from blendid.

alpgumus avatar alpgumus commented on May 18, 2024

Got this resolved by fixing the path of underscore in packages.json:

"underscore": "./node_modules/backbone/node_modules/underscore",

from blendid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.