Require.js not loading codemirror

I’m new to require.js and I’m pretty sure I’m making a very simple mistake.
I’ve installed codemirror with npm and the npm folder is one level up to the JS file where I’m trying to require codemirror.

Basically:

node_modules
js/app.js

I’m trying to do this but it fails to load the files:

require.config({
    packages: [{
        name: "codemirror",
        location: "../node_modules/codemirror",
        main: "lib/codemirror"
    }]
});
  
require([
        "lib/codemirror", 
        "mode/htmlmixed/htmlmixed",
        "mode/xml/xml",
], function(CodeMirror) {
    CodeMirror(document.getElementById("code"), {
        lineNumbers: true,
        mode: "htmlmixed"
    });
});

What am I doing wrong?

Only when I use absolute paths I am able to load them properly. For example:

http://localhost/demo/node_modules/codemirror/lib/codemirror

But then I get the JS error:

Any update please?