How can I get rid of the `Node “13.0.0-nightly20190802452b393c1f”` so that I can be able to create a react app using the `create-react-app` tool?

谁说我不能喝 提交于 2021-01-28 07:13:06

问题


I'm trying to create a react app using npx's create-react-app command in ubuntu 18.04 terminal. I have Node v12.8.0 installed. When I run the command npx create-react-app . in the directory of my app, I expect the react app boilerplate folders and files to be generated since I have the latest version of Node v12.8.0 and npm v6.10.2 in my machine.Instead, I get the below output...

npx: installed 91 in 5.725s

Creating a new React app in /home/<my-PC>/Documents/todo-app.

warning You are using Node "13.0.0-nightly20190802452b393c1f" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.17.3
warning You are using Node "13.0.0-nightly20190802452b393c1f" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
[1/4] Resolving packages...
[2/4] Fetching packages...
error @babel/core@7.5.5: The engine "node" is incompatible with this module. Expected version ">=6.9.0". Got "13.0.0-nightly20190802452b393c1f"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts --cwd /home/<my-PC>/Documents/todo-app has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting todo-app/ from /home/<my-PC>/Documents
Done.

So it ends up deleting the generated app folder as soon as it's created. I think it is being affected by the Node "13.0.0-nightly20190802452b393c1f" specified above. I have tried to locate it but I can't find it on my machine. On the terminal, when I run node -v I get the version v12.8.0 which is for nodejs. Am stuck here...


回答1:


  1. Uninstall the node js from ubuntu software manager.

  2. Then install node js with the following command:

    sudo apt-get update
    sudo apt-get install nodejs
    



回答2:


If you have multiple versions of nodejs installed, you could target them directly with the -p option:

npx -p node@12 

For create-react-app

npx -p node@12 create-react-app billion-dollar-project



回答3:


I had the same error and forcing create-react-app to use npm instead of yarn fixed it. Try npx create-react-app appname --use-npm




回答4:


Simply run the following:

create-react-app app-name --use-npm

This explicitly tells react to use npm instead of yarn.



来源:https://stackoverflow.com/questions/57463825/how-can-i-get-rid-of-the-node-13-0-0-nightly20190802452b393c1f-so-that-i-can

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!