Hey — I noticed that when embedding express-admin with the code shown under the "embedding" section of the documentation, none of the static assets are found. They all redirect to /admin/login. That's because of this line of code in express-admin/app.js:
This is looking for static assets in node_modules/express-admin/node_modules/express-admin-static. But express-admin-static isn't there; it's installed in the same node_modules that contains express-admin itself. Since npm version 3, npm installs sub-dependencies in a flat way.
Here's my suggestion on how to fix this. In this PR, I use the npm package get-installed-path to locate the real path to express-admin-static.
Hey — I noticed that when embedding express-admin with the code shown under the "embedding" section of the documentation, none of the static assets are found. They all redirect to
/admin/login
. That's because of this line of code inexpress-admin/app.js
:.use(serveStatic(path.join(__dirname, 'node_modules/express-admin-static')));
This is looking for static assets in
node_modules/express-admin/node_modules/express-admin-static.
Butexpress-admin-static
isn't there; it's installed in the samenode_modules
that containsexpress-admin
itself. Since npm version 3, npm installs sub-dependencies in a flat way.Here's my suggestion on how to fix this. In this PR, I use the npm package
get-installed-path
to locate the real path toexpress-admin-static
.