【问题标题】:Error: React native is not installed. Please run `npm install` in your project directory错误:未安装 React Native。请在您的项目目录中运行`npm install`
【发布时间】:2018-02-17 20:08:03
【问题描述】:

只需按照 facebook.github 上的说明进行 create-react-native-app 首先得到:react-redux 5.0.6 需要 react@^0.14.0 的 peer ||反应@^15.0.0-0 .... 然后我卸载了 react-redux 现在得到了这个......

here is package.json

错误启动打包程序

错误:未安装 React 本机。请在您的项目目录中运行 npm install。 上午 1:23:51:启动打包程序时出错:错误:无法启动项目。请修复 他出错并重新启动项目。 在 E:\xdl\src\Project.js:1126:11 在下一个(本机) 在步骤 (E:\react-native\hello-world\node_modules\xdl\build\Project.js:1504: 191) 在 E:\react-native\hello-world\node_modules\xdl\build\Project.js:1504:361 npm 错误!代码生命周期 npm 错误!错误号 1 npm 错误! hello-world@0.1.0 开始:react-native-scripts 开始 npm 错误!退出状态 1 npm 错误! npm 错误!在 hello-world@0.1.0 启动脚本中失败。 npm 错误!这可能不是 npm 的问题。可能有额外的日志 上面的输出。

npm 错误!可以在以下位置找到此运行的完整日志: npm 错误! C:\Users\Jawad Ul Hassan\AppData\Roaming\npm-cache_logs\2017-09-08 T20_23_51_654Z-debug.log

我的错误可能是什么,或者有什么关于正确做法的建议?

在 npm install 得到这个之后

npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Users\Jawad Ul Hassan\AppData\
Roaming\npm\node_modules\npm\node_modules\which\which.js:13:12)
npm WARN addRemoteGit     at F (C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:68:19)
npm WARN addRemoteGit at E (C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\nod
e_modules\npm\node_modules\which\which.js:80:29)
npm WARN addRemoteGit     at C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_m
odules\npm\node_modules\which\which.js:89:16
npm WARN addRemoteGit     at C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_m
odules\npm\node_modules\which\node_modules\isexe\index.js:42:5
npm WARN addRemoteGit     at C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_m
odules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
npm WARN addRemoteGit     at C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_m
odules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15)
npm WARN addRemoteGit  expo/node-websql#18.0.0 resetting remote C:\Users\Jawad U
l Hassan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-websql-
git-18-0-0-8213877d because of error: { Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Users\Jawad Ul Hassan\AppData\
Roaming\npm\node_modules\npm\node_modules\which\which.js:13:12)
npm WARN addRemoteGit     at F (C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\nod
e_modules\npm\node_modules\which\which.js:68:19)
npm WARN addRemoteGit     at E (C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\nod
e_modules\npm\node_modules\which\which.js:80:29)
npm WARN addRemoteGit     at C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_m
odules\npm\node_modules\which\which.js:89:16
npm WARN addRemoteGit     at C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_m
odules\npm\node_modules\which\node_modules\isexe\index.js:42:5
npm WARN addRemoteGit     at C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_m
odules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
npm WARN addRemoteGit     at C:\Users\Jawad Ul Hassan\AppData\Roaming\npm\node_m
odules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOGIT'
}
npm ERR! git clone --template=C:\Users\Jawad Ul Hassan\AppData\Roaming\npm-cache
\_git-remotes\_templates --mirror git@github.com:expo/node-websql.git C:\Users\J
awad Ul Hassan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-w
ebsql-git-18-0-0-8213877d: undefined
npm ERR! git clone --template=C:\Users\Jawad Ul Hassan\AppData\Roaming\npm-cache
\_git-remotes\_templates --mirror git@github.com:expo/node-websql.git C:\Users\J
awad Ul Hassan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-w
ebsql-git-18-0-0-8213877d: undefined

【问题讨论】:

  • 尝试在您的目录中运行npm install,如果这不能解决,则编辑您的消息添加您的 package.json 文件。希望对你有帮助
  • npm 安装后
  • 尝试安装 git... 然后重做你的npm install

标签: reactjs react-native react-redux


【解决方案1】:

当我安装 react-navigation 包时,我发生了错误。我已经解决了我的问题

  1. 删除node_modules、package-lock.json
  2. 运行“yarn install”。
  3. 运行“npm start”。

【讨论】:

    【解决方案2】:

    这可能是因为 npm 版本 v5 所以

    npm 5 仍然有很多 bug,请使用 yarn 或 npm 版本 4。

    npm i -g yarn
    npm i -g npm@4
    

    或者确保从项目目录执行 npm install。这也是你得到这个错误的原因之一

    npm i
    

    【讨论】:

      【解决方案3】:

      你可以在第一行看到没有找到 git

      ==> npm WARN addRemoteGit 错误:未找到:git

      先安装 git。

      【讨论】:

        猜你喜欢
        • 2017-05-20
        • 1970-01-01
        • 2021-02-26
        • 1970-01-01
        • 2019-11-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多