diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 55264c35e6f8a0..b9dbf794511528 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -31,6 +31,7 @@ const { ArrayPrototypePush, ArrayPrototypeSlice, ArrayPrototypeSplice, + ArrayPrototypeUnshift, Boolean, Error, JSONParse, @@ -1204,8 +1205,8 @@ Module._initPaths = function() { let paths = [path.resolve(prefixDir, 'lib', 'node')]; if (homeDir) { - paths.unshift(path.resolve(homeDir, '.node_libraries')); - paths.unshift(path.resolve(homeDir, '.node_modules')); + ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries')); + ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_modules')); } if (nodePath) {