Ali Aliakbar
Ali Aliakbar

Reputation: 33

create-react-app results in "npm" is not recognized

I have been working with react for almost 1 year. I didn't have this problem but since I re-installed my OS, I cant use commands like : 'npx create-react-app my-app' and it get this result :

'"node"' is not recognized as an internal or external command,
operable program or batch file.

I have

but nothing works.

When I type in 'node -v' or 'npm -v' i get the version back. so they are recognized in the system. and also when I use yarn, this happens :

yarn create react-app client

yarn create v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "[email protected]" with binaries:
      - create-react-app

Creating a new React app in D:\Projects\DEVCONNECTOR\client.

'npm' is not recognized as an internal or external command,
operable program or batch file.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

'npm' is not recognized as an internal or external command,
operable program or batch file.

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom [email protected] has failed.

Deleting generated file... package.json
Deleting client/ from D:\Projects\DEVCONNECTOR
Done.
error Command failed.
Exit code: 1
Command: C:\Users\damon\AppData\Local\Yarn\bin\create-react-app
Arguments: client
Directory: D:\Projects\DEVCONNECTOR
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

So it first begins to install the package but then I get the same error and the package gets deleted. although I can use yarn in other commands like starting the server etc.

Thanks in advance

Upvotes: 1

Views: 235

Answers (1)

Mohamed Mehdi Gara
Mohamed Mehdi Gara

Reputation: 11

Try deleting node modules and package-lock.json and run command yarn create-react-app client.

If it does not work try yarn create-react-app client --legacy-peer-deps

Upvotes: 1

Related Questions