命令“ npx create-react-app项目”不生成项目 [英] command "npx create-react-app project" not generating project

查看:91
本文介绍了命令“ npx create-react-app项目”不生成项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

突然,当我输入
npx create-react-app项目

我开始出现此错误是:
在包config /home/swaraj/.npm/_npx/8451/lib/node_modules/create-react-app/node_modules/is中定义的无效导出主要目标 index.js -promise / package.json

The error is : Invalid "exports" main target "index.js" defined in the package config /home/swaraj/.npm/_npx/8451/lib/node_modules/create-react-app/node_modules/is-promise/package.json

有人可以告诉我这是什么错误以及如何解决该错误

Can anybody tell me what's this error and how to resolve it

推荐答案

这必须表示您的package.json已损坏。
我也有同样的问题,当我重新创建/编辑package.json试图访问它时,它已为我解决。

This must mean that your package.json is broken. I just had the same problem, and it fixed for me when I recreated/edited the package.json it is trying to access.

Type yarn init -y 并读取package.json

Type yarn init -y and read the package.json

添加以下几行:

"resolutions": {
    "is-promse": "2.1.0",
    "run-async/is-promise": "2.1.0"
  }

之后再做纱线添加- dev create-react-app ,然后尝试使用以下命令编译您的reactjs应用程序:

Afterwards do yarn add --dev create-react-app and then try to compile your reactjs application using:

yarn create-react-app < PATH / APP-NAME>

我还建议尝试手动删除is-promise属性。我认为该命令的名称为 npm remove is-promise ,但我不确定。

I would also recommend trying to manually remove is-promise property. I think the command for that was called npm remove is-promise, but I am not sure.

但是我非常确定您的package.json需要修复:)
如果它不起作用,我会尝试找到其他解决方法。

But I am pretty sure that your package.json needs a fix :) Reply if it didn't work, I'll try to find a different way-around then.

这篇关于命令“ npx create-react-app项目”不生成项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆