I have a front-end SPA using RequireJS (2.1.14) as a modular system. It mainly downloads and downloads the Backbone.Marionette app.
In main.js :
require.config ({ baseUrl: '/js', waitSeconds: 200, nodeRequire: require, paths: { jquery: '//cdn/jquery.min', underscore:'//cdn/underscore-min', // more plugins }, shim: { // shimming stuff } }); require(['marionette', 'vent', 'config/template', 'app', 'routers/main' ], function (Marionette, vent, Template, nrtApp ) { 'use strict'; nrtApp.module ('Public.Main', function (Main, nrtApp, Backbone,Marionette, $, _) { nrtApp.start (); // this is where the error is: requirejs (['config'], function (config) { if (typeof config !== 'undefined') {config.log ('ok!');} }); }); });
The problem is that I would like to download some npm packages (e.g. npm install config) from the RequireJS module. RequireJS cannot find the npm node_modules , which is in a different directory than the RequireJS baseUrl directory .
The following is my directory structure:
my_project/ app/ public/ js/ main.js app.js node_modules/ config/
The following is the error message:

He tried to load the module from the baseUrl directory.
How can I access the npm module from the RequireJS module system in my use case?