reactjs - 为什么 termux 没有权限在 create-react-app 中创建 gitignore 文件

标签 reactjs create-react-app termux

我尝试使用 create-react-app 安装 react 但它显示以下错误:

/data/data/com.termux/files/home/mya2/node_modules/react-scripts/scripts/init.js:153
      throw err;
      ^

Error: EACCES: permission denied, link '/data/data/com.termux/files/home/mya2/gitignore' -> '/data/data/com.termux/files/home/mya2/.gitignore'
    at Object.linkSync (fs.js:956:3)
    at tryRenameSync (/data/data/com.termux/files/home/mya2/node_modules/fs-extra/lib/move-sync/index.js:40:12)
    at Object.moveSync (/data/data/com.termux/files/home/mya2/node_modules/fs-extra/lib/move-sync/index.js:22:3)
    at module.exports (/data/data/com.termux/files/home/mya2/node_modules/react-scripts/scripts/init.js:141:8)
    at [eval]:3:14
    at Script.runInThisContext (vm.js:123:20)
    at Object.runInThisContext (vm.js:312:38)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at evalScript (internal/bootstrap/node.js:720:27)

Aborting installation.
  node  has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Done.
%

最佳答案

为了在 Termux 上安装 React 并使用 create-react-app 创建应用程序,您必须执行以下操作:

如果尚未安装 npx,请安装:

$ npm install -g npx

安装create-react-app

$ npm install create-react-app -g

清理你的 npm 缓存以避免“ERR!” cb() 从未调用过!'错误

$ npm cache clean --force

如果您想创建一个名为“apprx”的应用程序,请先创建该文件夹,然后将其打开:

mkdir apprx && cd apprx

现在创建以下文件;

$ touch .gitignore

返回上一级

$ cd ../

运行“create-react-app”:

$ npx create-react-app apprx

这需要一段时间,但它会设置。完成后:

$ cd apprx

启动应用程序

$ npm start

在华为 M5 8 和三星 Note 8 上进行了测试

关于reactjs - 为什么 termux 没有权限在 create-react-app 中创建 gitignore 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54073889/

相关文章:

reactjs - Material 用户界面 : Place a space between two Typography components

reactjs - 使用 create-react-app 获取开放图元数据

reactjs - CSS 模块类名未定义

python - 安装基于 pyproject.toml 的项目所需的错误 : Could not build wheels for coincurve,

android - 如何在 Android 设备上安装 Jupyter notebook?

javascript - Tailwind 中的最小 margin

javascript - react route 的大写情况

android - 从 termux 命令行启动蓝牙

reactjs - Apollo中如何返回用户对象的id属性?

reactjs - 如何使用 docker + React-create-app 获得生产版本?