line 1: This: command not found
Asked Answered
V

3

3

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 .

Vine answered 3/3, 2023 at 5:41 Comment(1)
still not working any other tips?Vine
M
34

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

Michelinamicheline answered 10/8, 2023 at 8:16 Comment(1)
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.Trinitarianism
F
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
Feola answered 3/3, 2023 at 6:20 Comment(3)
i added the output in the postVine
check my edits, tell us what aboutFeola
i ran the commands in my terminal but npx create-react-app my-app-name doesnt work but when i use create-react-app app-name it gives a different errorVine
D
-1

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.

Debor answered 13/7, 2023 at 13:18 Comment(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.Stupe
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 ReviewUlrick

© 2022 - 2024 — McMap. All rights reserved.