Yesterday my React Native project is working well, but today after I open my React Native project and running "npm start" or "react native-run-android" without adding any codes or libraries yet it always give me error now. I'm just confused I did nothing but I'm getting error.
This is the error I got by running "npm start" or "react-native run-android" :
Loading dependency graph...events.js:167
throw er; // Unhandled 'error' event
^
Error: UNKNOWN: unknown error, lstat 'D:\React Native Projects\TheProject\node_modules\babel-register'
Emitted 'error' event at:
at NodeWatcher.checkedEmitError (D:\React Native Projects\TheProject\node_modules\sane\src\node_watcher.js:159:10)
at Walker.emit (events.js:182:13)
at D:\React Native Projects\TheProject\node_modules\walker\lib\walker.js:52:12
at D:\React Native Projects\TheProject\node_modules\graceful-fs\polyfills.js:282:31
at FSReqWrap.oncomplete (fs.js:154:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! TheProject#0.0.1 start: node node_modules/react-native/local-cli/cli.js start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the TheProject#0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The easiest thing would be to install Watchman in mac:
$ brew update
$ brew install watchman
If you don't have brew, do this first:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Related
i got an node error, the cause is to use jenkins to build the projec.
Error: write EPIPE
at process.target._send (internal/child_process.js:841:20)
at process.target.send (internal/child_process.js:712:19)
at callback (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:32:17)
+ npm run build
> widsomfarm_admin_v2#0.1.0 build /home/jenkins/agent/workspace/dvf/F-adopt-backoffice/codeDir
> vue-cli-service build
- Building for production...
WARN A new version of sass-loader is available. Please upgrade for best experience.
Killed
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! widsomfarm_admin_v2#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the widsomfarm_admin_v2#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /softdata/npm_local_repository/_logs/2022-10-28T09_05_45_429Z-debug.log
events.js:377
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at process.target._send (internal/child_process.js:841:20)
at process.target.send (internal/child_process.js:712:19)
at callback (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:32:17)
at module.exports (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/terser-webpack-plugin/dist/worker.js:13:5)
at handle (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:44:8)
at process.<anonymous> (/home/jenkins/agent/workspace/dvf.dvf/test-deploy/F-adopt-backoffice/codeDir/node_modules/worker-farm/lib/child/index.js:55:3)
at process.emit (events.js:400:28)
at emit (internal/child_process.js:912:12)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
Emitted 'error' event on process instance at:
at internal/child_process.js:845:39
at processTicksAndRejections (internal/process/task_queues.js:77:11) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
Shell Script -- npm run build (self time 1min 10s)
This could be caused by not running npm install before the npm run build in jenkins.
npm install -g #vue/cli
# OR
yarn global add #vue/cli
Also building with CI/CD tools like Jenkins sometimes requires npm install to be replaced with npm ci to make sure doing a clean install of your dependencies. More here npm ci
npm ci
npm run build
...
I get this error too , but only when run build in server environment.
after search about this problem, i found that it because memory limitation ,but unfortunately i couldn't find the right solution .
Maybe this lead will able to help you
I tested with a simple app generated by
npx create-react-app myfirstreact
It works fine with
npm start
but if I try to run it in the background with
nohup npm start &
I get
Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^
Error: EBADF: bad file descriptor, read Emitted 'error' event at:
at lazyFs.read (internal/fs/streams.js:165:12)
at FSReqWrap.wrapper [as oncomplete] (fs.js:467:17) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! myfirstreact#0.1.0 start:
react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed
at the myfirstreact#0.1.0 start script. npm ERR! This is probably not
a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR!
/home/jglickman/.npm/_logs/2020-10-06T04_43_39_480Z-debug.log
Try running it like this:
nohup node scripts/start.js
I think this post will help too.
So I'm following this tutorial to try and learn React Native: https://www.youtube.com/watch?v=qSRrxpdMpVc
And in the tutorial he shows to install expo cli using the line
'npm install expo-cli --global'
But when i run that line, i get a whole bunch of warnings saying for example:
npm WARN deprecated topo#3.0.3: This module has moved and is now available at #hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
In the tutorial he says to ignore this but at the end of the install i get this error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! envsub#3.1.0 postinstall: `test -d .git && cp gitHookPrePush.sh .git/hooks/pre-push || true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the envsub#3.1.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Alex\AppData\Roaming\npm-cache\_logs\2019-12-06T01_25_52_024Z-debug.log
and then when i try to run the line 'expo init first-app' to create a project i get this error:
Error: Cannot find module 'C:\Users\Alex\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js'
[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:690:27)[39m
[90m at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)[39m
[90m at internal/main/run_main_module.js:17:11[39m {
code: [32m'MODULE_NOT_FOUND'[39m,
requireStack: []
}
I also found a similar question with an answer of try running
npm cache clean --force
npm install -g expo-cli
So i tried that but it didnt work.
Does anyone know why i would be getting these errors? I tried reinstalling node but that doesnt seem to fix it. Thanks for the help in advance, keep in mind i am completely new to react native
Assuming that you have Node 10 LTS or greater installed, you can use npm to install the Expo CLI command line utility:
npm install -g expo-cli
expo init AwesomeProject
cd AwesomeProject
npm start # you can also use: expo start
This question already has answers here:
Node.js: what is ENOSPC error and how to solve?
(17 answers)
Closed 3 years ago.
I am currently working on a react project and have already developed the basic components. Everything was working fine yesterday. Then I started a new react native project. After installing the project using create-react-native-app, the npm start command failed to start the server but it was working just fine for the react project.
I was using node 10.6 and npm 5.6. After reading some suggestions, I changed node to v8.11 and npm to 6.2. After installing watchman and changing the inotify watches, I finally fot the native app to start.
Today, I tried to start the react project and the server is not starting.
This is what the terminal is displaying...
Starting the development server...
events.js:183
throw er; // Unhandled 'error' event
^
Error: watch /home/maneesh/source_code/react/ytc/public ENOSPC
at _errnoException (util.js:992:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at createFsWatchInstance (/home/maneesh/source_code/react/ytc/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/maneesh/source_code/react/ytc/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/maneesh/source_code/react/ytc/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/maneesh/source_code/react/ytc/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/maneesh/source_code/react/ytc/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/maneesh/source_code/react/ytc/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:153:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ytc#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ytc#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I am using ubuntu 18.04
node 8.11
npm 6.2
Any idea what the problem could be?
You can run the below command to avoid ENOSPC:
echo fs.inotify.max_user_watches=524288 | sudo tee -a
/etc/sysctl.conf && sudo sysctl -p
For Arch Linux add this line to /etc/sysctl.d/99-sysctl.conf:
fs.inotify.max_user_watches=524288
Finally, run:
sysctl --system
This will also persist across reboots.
Source: https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers#the-technical-details
try this
create-react-app my-app
cd my-app
npm install react-scripts#2.1.8
npm start
Not sure if the problem is related to laravel-mix, but I am having problem with Browsersync package. Here is my mix.js:
mix.js('resources/assets/js/app.js', 'public/js')
.browserSync({proxy: 'localhost:8000'})
.sass('resources/assets/sass/app.scss', 'public/css');
When I run npm run watch-poll ( watch doesn't pick up the changes, hence the watch-poll see here ) I get the following error on the console:
[Browsersync] Watching files...
events.js:160
throw er; // Unhandled 'error' event
^
Error: watch resources/views/auth/passwords ENOSPC
at exports._errnoException (util.js:1020:11)
at FSWatcher.start (fs.js:1443:19)
at Object.fs.watch (fs.js:1470:11)
at createFsWatchInstance (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch-poll"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tanmay/.npm/_logs/2017-08-07T07_02_31_677Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch-poll: `npm run watch -- --watch-poll`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch-poll script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tanmay/.npm/_logs/2017-08-07T07_02_31_725Z-debug.log
I am on: Ubuntu 16.04.3 (Not a VM). Running: Nodejs v6.11.2, NPM v5.3.0
When I comment out the .browserSync() call from my mix.js:
mix.js('resources/assets/js/app.js', 'public/js')
// .browserSync({proxy: 'localhost:8000'})
.sass('resources/assets/sass/app.scss', 'public/css');
however, the error no longer persists. How do I get around the problem? Please feel free to ask any other necessary information.
Here is my package.json file
UPDATE: This error doesn't occur on a new laravel project. To get the same result as a new project, this is what I did:
I removed the node modules: rm -rf node_modules I removed the package-lock.json file: rm package-lock.json I re-run: npm install, npm run dev, npm run watch-poll
Result: still same error :(
This might be due to another task running on port 4040 already.
You can try killall -9 node
Source/more details: https://github.com/parse-community/parse-dashboard/issues/401#issuecomment-224007436
I suspect it's the same problem that is shown & with working solution from Gulp Error: watch ENOSPC
Try this: Why this issue occured? There is the limit in the number of
files that can be watched in a system. We have to increase this
number. The below command can be used to increase this number.
$ echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p