Win10环境下全新安装Node.js v16.14.0后运行create-react-app报错求助
Hi everyone, I'm stuck on a frustrating issue when trying to set up a new React app using create-react-app on Windows 10, and I haven't been able to find any relevant, up-to-date solutions online—most related posts are outdated and don't match my scenario. Let me walk through the details:
My Environment
- OS: Latest Windows 10
- Node.js: LTS v16.14.0 (clean, fresh install on the system drive; environment variables/paths are configured correctly)
What I've Tried
- First, I ran the standard command:
npx create-react-app myapp - When that failed, I tried installing create-react-app locally first:
Then ran:npm i create-react-appnpm init react-app my-app
Full Error Output
C:\Users\Keith & Vanny>npx create-react-app myapp 'Vanny\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\.bin\' is not recognized as an internal or external command, operable program or batch file. node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'C:\Users\create-react-app\index.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
My Thoughts
I think the root issue is the path parsing failure you can see in the first line of the error—Windows Command Prompt is splitting my username (Keith & Vanny) at the space, so it's trying to access Vanny\AppData\... instead of the full path. Even though Node was installed cleanly and my environment paths check out, this batch script parsing error seems to be preventing create-react-app from installing properly.
I'm really stuck here and might have to reach out to the create-react-app core team if I can't find a workaround. Has anyone else run into this exact issue, or does anyone know how to fix it?
内容的提问来源于stack exchange,提问作者Keith Cronin

