0

I have an issue. Whenever I try to run any npx command on my windows 11 system I get this error

C:\Users\JOEL MATHEW\node_modules.bin/../node/bin/node: line 1: This: command not found

I have been facing this issue for a long time and it's still bothering me.

$ npx -v

9.5.0

$ npm -v

9.5.0

$ node -v

v18.14.2

$ npx create-react-app test

C:\Users\JOEL MATHEW\node_modules.bin/../node/bin/node: line 1: This: command not found

This image shows the error that is printed on my terminal after I run create-react-app .

3 Answers3

3

I finally fixed my issue.

I received the error every time I ran the following $ eas build -p android --profile preview $ eas build -p android

Steps to fix: Navigate to: C:\Users\USRN\AppData\Roaming\npm\node_modules\node\bin\

On mine I found two node files, one that was a .exe and other other as just a text file

So I deleted the non executable file.

Hope this helps someone in future

  • Unbelievable. I upvoted this because this, of all the things I tried, actually fixed my problem as well. I could not grunt for the life of me. I tried uninstalling, reinstalling npx, npm, node, I tried installing different versions, etc, but nothing worked. Deleting this file fixed it. Hope this helps others. – sansae Aug 24 '23 at 15:59
0

Check this to ensure npm npx installed:

npm --v
npx --v

Try this: (uninstall the create-react-app package)

npm uninstall create-react-app
npm uninstall -g create-react-app
npm cache clean --force

And then: (install create-react-app globally)

npm install -g create-react-app

So then try again:

npx create-react-app my-app-name
ferter3006
  • 299
  • 10
0

I was able to fix a similar problem recently through this thread. Command not found - firebase login/firebase-tools.

I am thinking it has something to do with your prefix.

Matt Ly
  • 1
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 16 '23 at 08:58
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/34685221) – Chenmunka Jul 17 '23 at 15:37