Skip to content

[BUG] Breaks when run cross-platform #1

@cloewen8

Description

@cloewen8

If this is installed on Windows, and than is reinstalled on Linux later, the postinstall script will break:

node node_modules/allow-require-me/allow-require-me.js add && node node_modules\\allow-require-me\\allow-require-me.js add

I believe this is due to postinstall getting backslash separators on Windows, which are treated as invalid escape characters on Linux that get discarded ("node_modulesallow-require-meallow-require-me.js").

$ npm install

> parent@8.10.2 postinstall
> node node_modules/allow-require-me/allow-require-me.js add && node node_modules\allow-require-me\allow-require-me.js add

allow-require-me.js, package: parent, action: add, self link already exists: node_modules/parent
node:internal/modules/cjs/loader:1252
  throw err;
  ^

Error: Cannot find module '/mnt/Home/Documents/GitHub/parent/node_modulesallow-require-meallow-require-me.js'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
    at Function._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
    at node:internal/main/run_main_module:36:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v22.12.0
npm error code 1
npm error path /mnt/Home/Documents/GitHub/parent
npm error command failed
npm error command sh -c node node_modules/allow-require-me/allow-require-me.js add && node node_modules\allow-require-me\allow-require-me.js add
npm error A complete log of this run can be found in: /home/name/.npm/_logs/2025-01-01T00_51_09_148Z-debug-0.log

I found removing the postinstall script (from the parent package) and running npm install again fixes this temporarily.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions