[OE-core] [PATCH] npm: change install directory to upstream default

Dan McGregor danismostlikely at gmail.com
Fri Oct 26 17:46:07 UTC 2018


On Fri, 19 Oct 2018 at 09:29, Olaf Mandel <o.mandel at menlosystems.com> wrote:
>
> The node binary searches for packages in a number of locations, the last
> of which is $PREFIX/lib/node (here: /usr/lib/node) from the list of
> GLOBAL_FOLDERS [1]. Change the installation directory for all packages
> depending on npm.bbclass to that location. This removes the need to
> define the NODE_PATH variable to the non-standard /usr/lib/node_modules
> value.
>
> While the Tips for Package Managers [2] discusses installing packages to
> /usr/lib/node_modules/<name>/<version>, this has several drawbacks:
>
>  * it does not work for the REPL as mentioned in the documentation
>  * it also does not work for any code _not_ installed as a global
>    package under /usr/lib/node_modules (e.g. /usr/share/foo.js will not
>    find any packages below /usr/lib)
>  * using the non-default location and then having to set NODE_PATH
>    barely saves any time: there are only two file-system lookups (to the
>    legacy $HOME/.node_modules and $HOME/.node_libraries) directories
>    before the library would be found
>
> And the suggestion was made in the context of deduping the node_modules
> tree by installing all packages in a flat hierarchy and using symlinks
> to the correct version of each dependency. This is not what OpenEmbedded
> does, so none of those benefits (deduping, cleaner packages) are being
> had by shifting the installation directory to /usr/lib/node_modules.
>
> [1]: https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
> [2]: https://nodejs.org/api/modules.html#modules_addenda_package_manager_tips
>
> Signed-off-by: Olaf Mandel <o.mandel at menlosystems.com>
> ---
>  meta/classes/npm.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
> index c351ff0866..d5ff0c6d57 100644
> --- a/meta/classes/npm.bbclass
> +++ b/meta/classes/npm.bbclass
> @@ -10,7 +10,7 @@ def node_pkgname(d):
>
>  NPMPN ?= "${@node_pkgname(d)}"
>
> -NPM_INSTALLDIR = "${D}${libdir}/node_modules/${NPMPN}"
> +NPM_INSTALLDIR = "${D}${libdir}/node/${NPMPN}"

Ï realise this has already gone în, but should this be
${nonarch_libdir}, or does it use /usr/lib64 or /usr/libx32 correctly?

>
>  # function maps arch names to npm arch names
>  def npm_oe_arch_map(target_arch, d):
> --
> 2.11.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



More information about the Openembedded-core mailing list