kentcdodds / cross-env

🔀 Cross platform setting of environment scripts
https://www.npmjs.com/package/cross-env
MIT License
6.32k stars 243 forks source link

More than 3 parent directories (..) in path ignored on Windows #244

Closed abidingotter closed 3 years ago

abidingotter commented 4 years ago

Multiple parent directories (in my case, 5) has been treated as 3

package.json

{
...
  "scripts": {
    "prepare": "cross-env-shell \"cd ../../../../../otherproject && npm ci build\""

Output

> cross-env-shell "cd ../../../../../otherproject && npm ci build"

'..\..\..\otherproject ' is not recognized as an internal or external command,
operable program or batch file.
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn ..\..\..\otherproject && npm ci build ENOENT
    at notFoundError (….\node_modules\cross-spawn\lib\enoent.js:6:26)

Note that only three sets of ".." are present in the error. Placing an absolute path in the command works, so the problem is restricted to the parsing of the parent directories.

abidingotter commented 4 years ago

Note that this is not an issue for the developers using a Linux based OS

kentcdodds commented 3 years ago

https://github.com/kentcdodds/cross-env/issues/257