Replies: 3 comments 3 replies
-
|
What happens when you just run the file? With no package managers? |
Beta Was this translation helpful? Give feedback.
-
|
I encountered another problem about console.log(process.argv.slice(2));When I execute
Could you please help me take a look? Thanks. @avivkeller |
Beta Was this translation helpful? Give feedback.
-
|
Windows being Windows. NTFS is case-insensitive but case-preserving, so the actual stored path might be The difference you're seeing comes from how npm and pnpm spawn child processes:
Neither is wrong. Both paths point to the same directory. If you need consistent casing, import { realpathSync } from "node:fs";
const canonicalCwd = realpathSync.native(process.cwd());Or for path comparison, just go case-insensitive on Windows: import path from "node:path";
function samePath(a, b) {
return path.resolve(a).toLowerCase() === path.resolve(b).toLowerCase();
}Regarding your follow-up about |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
I started a terminal locally, as shown below. (Note that the path starts with lowercase.)
I wrote a simple code test as shown below.
When I start the script using

pnpmandnpm, I get two different results. I noticed that when I started it withpnpm, the first line of information printed had an additional capitalized path compared to when I started it withnpm.I tried debugging the code, but I couldn't see the implementation inside
rawMethods.cwd().If you have time, please take a look, thank you. @redyetidev
Beta Was this translation helpful? Give feedback.
All reactions