当前位置: 首页 > 面试题库 >

npm ERR!在project@0.0.1启动脚本'react-native start'处失败

酆鸿彩
2023-03-14
问题内容

npm -v:3.10.10 react-native -v:0.1.7节点-v:v6.9.5 Ubuntu:16.04值班员-v:4.5.0

重新执行react-native初始化项目cd project和react-native run-
android时,当我执行npm开始运行服务器时,我遇到以下错误:

project@0.0.1 start /home/sofiane/projet/merde2
> react-native start

Cannot parse yarn version: 0.22
Scanning 547 folders for symlinks in /home/sofiane/projet/project/node_modules (3ms)
 ┌────────────────────────────────────────────────────────────────────────────┐ 
 │  Running packager on port 8081.                                            │ 
 │                                                                            │ 
 │  Keep this packager running while developing on any JS projects. Feel      │ 
 │  free to close this tab and run your own packager instance if you          │ 
 │  prefer.                                                                   │ 
 │                                                                            │ 
 │  https://github.com/facebook/react-native                                  │ 
 │                                                                            │ 
 └────────────────────────────────────────────────────────────────────────────┘ 
Looking for JS files in
   /home/sofiane/projet/project

Loading dependency graph...
React packager ready.

jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
  Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
  Error: A non-recoverable condition has triggered.  Watchman needs your help!
The triggering condition was at timestamp=1488805737: inotify-add-watch(/home/sofiane/projet/sql3/node_modules/react-native/ReactAndroid/src/main/third-party/java/junit) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem.  You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

 ERROR  A non-recoverable condition has triggered.  Watchman needs your help!
The triggering condition was at timestamp=1488805737: inotify-add-watch(/home/sofiane/projet/sql3/node_modules/react-native/ReactAndroid/src/main/third-party/java/junit) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem.  You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

{"watchmanResponse":{"version":"4.5.0","error":"A non-recoverable condition has triggered.  Watchman needs your help!\nThe triggering condition was at timestamp=1488805737: inotify-add-watch(/home/sofiane/projet/sql3/node_modules/react-native/ReactAndroid/src/main/third-party/java/junit) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl\nAll requests will continue to fail with this message until you resolve\nthe underlying problem.  You will find more information on fixing this at\nhttps://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch\n"}}
Error: A non-recoverable condition has triggered.  Watchman needs your help!
The triggering condition was at timestamp=1488805737: inotify-add-watch(/home/sofiane/projet/sql3/node_modules/react-native/ReactAndroid/src/main/third-party/java/junit) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl
All requests will continue to fail with this message until you resolve
the underlying problem.  You will find more information on fixing this at
https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

    at ChildProcess.<anonymous> (/home/sofiane/projet/project/node_modules/fb-watchman/index.js:207:21)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.

npm ERR! Linux 4.8.0-39-generic
npm ERR! argv "/home/sofiane/.nvm/v6.9.5/bin/node" "/home/sofiane/.nvm/v6.9.5/bin/npm" "start"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! merde2@0.0.1 start: `react-native start`
npm ERR! Exit status 11
npm ERR! 
npm ERR! Failed at the merde2@0.0.1 start script 'react-native start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the merde2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-native start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs merde2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls merde2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/sofiane/projet/project/npm-debug.log

问题答案:

我在ubuntu中遇到了同样的问题,对我有用的是我关闭的终端从重新启动的USB中删除了我的设备。首先建议您将这些行添加到package.json中,用以下命令替换脚本

"scripts": {
"prepare-repository": "npm i -g react-native-cli yarn;yarn install; react-native link",
"emulator": "emulator -avd Nexus5V6L23_x86_64 -scale 1.0",
"install": "react-native run-android",
"start": "react-native start --reset-cache",
"android": "npm run install && npm run start",
"clean": "watchman watch-del-all && npm cache clean && cd android && ./gradlew clean && cd ..",
"test": "jest"
}

之后,将其保存,然后转到创建项目的文件夹。假设我的住所/工作区/演示。在运行脚本中

npm run clean this will clear all cache

之后

npm run android

它将在设备以及启动重置缓存中运行应用程序。让我知道它是否有帮助。

编辑!!!有时在运行npm run android之前添加adb reverse tcp:8081会执行tricj



 类似资料:
  • 问题内容: 我是高级新手,请多多包涵。 我已经从另一位工程师那里继承了python脚本。为了方便起见,我希望能够从Windows bat文件启动脚本,但最初尝试通过从Windows命令行运行进行调试。 每当我从CMD启动脚本时,它似乎都可以启动,然后立即因错误而失败。 我的环境:Windows7 Pro和Windows10 Pro(发生相同的错误),Anaconda 3.7,Spyder 3.3.

  • Main application script - server.js (启动脚本) 以下案例为 构建器生成代码: /** * 加载 model, 创建基础 app */ var loopback = require('loopback'); var boot = require('loopback-boot'); var app = module.exports = loopback();

  • 4. bash启动脚本 启动脚本是bash启动时自动执行的脚本。用户可以把一些环境变量的设置和alias、umask设置放在启动脚本中,这样每次启动Shell时这些设置都自动生效。思考一下,bash在执行启动脚本时是以fork子Shell方式执行的还是以source方式执行的? 启动bash的方法不同,执行启动脚本的步骤也不相同,具体可分为以下几种情况。 4.1. 作为交互登录Shell启动,或者

  • 问题内容: 首先,这可能需要移至超级用户。我无法确定哪个场地更好。 我正在尝试编写一个将在启动/重新启动时运行的R脚本,并将该计算机添加到doRedis工作者池中。(doRedis是一个foreach后端)。 这是我的R脚本“〜/ Rworker.R” 我可以使用command从命令行运行此脚本 。 接下来,我编写了一个shell脚本来运行R脚本,标题为“ /etc/init.d/StartWor

  • 当我运行npm start时,我看到错误。 我尝试过这个方法,但没有成功:https://techoverflow.net/2019/04/01/how-to-fix-npm-err-missing-script-start/ {“private”:true,“scripts”:{“dev”:“npm运行development”,“development”:“cross-env node_env=

  • 问题内容: 尝试使用npm start命令调试节点应用程序时收到此错误。 错误: npm ERR!Windows_NT 6.3.9600 npm错误!argv“ C:\ Program Files \ nodejs \\ node.exe”“ C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ npm- cli.js”“开始” n​​pm