reactjs npm start ELIFECYCLE error - reactjs

This is my first attempt at learning react, and it's started terribly. I've gone through the instructions directed here: https://facebook.github.io/react/docs/installation.html on the "Create a New App" tab exactly. Haven't done anything differently.
I'm using node 8.1.3, and npm 5.0.4
(I've also tried downgrading node to 6.11 without success).
I don't get any errors at all during installation.
When I run npm start, I get this super unhelpful error:
Starting the development server...
events.js:182
throw er; // Unhandled 'error' event
^
Error: watch /var/phil-machine/Code/react/test1/public ENOSPC
at exports._errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1384:19)
at Object.fs.watch (fs.js:1410:11)
at createFsWatchInstance (/var/phil-machine/Code/react/test1/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/var/phil-machine/Code/react/test1/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/var/phil-machine/Code/react/test1/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/var/phil-machine/Code/react/test1/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/var/phil-machine/Code/react/test1/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/var/phil-machine/Code/react/test1/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! test1#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test1#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/phil/.npm/_logs/2017-07-05T23_52_25_652Z-debug.log
I'm at a loss. I've googled it (as best as I can - I'm not even sure what to google apart from the generic "react start error"), and got this answer https://stackoverflow.com/a/39960890/1569591 but that didn't help either.
When I run npm start it brings up the above error, and opens the bowser with a "Site cant be reached" error.
Can anyone help point me in the direction of how to fix this?
I've also tried changing the start command to use a different port:
PORT=3001 react-scripts start
Didn't work either.

Looks like an issue with node, ENOSPC means that there is no space on the drive.
Perhaps /tmp is full? You can configure npm to use a different temp folder by setting npm config set tmp /path/to/some/other/dir, or maybe delete everything out of the /tmp folder.
Source: ENOSPC in npm's repo in github.

I'm not entirely sure if this was the issue, but I've got it working.
It turns out another service, Grafana was using localhost port 3000. I removed Grafana and it still failed. After rebooting it appeared to work.
Again, I'm not sure if this will solve it 100% if others have the same problem, but this is what solved it for me.

I don't know which Operating System you are using but if you are using Fedora or CentOS try disabling selinux.
I had similar issue, but after disabling selinux it started working perfectly.

Related

Why Can't launch React App after closing it?

Complete newbie with React, and it seems so much more convoluted than anything i've experienced. the coding is easier than JavaScript. running the applications on the other hand... a complete nightmare...
Just followed a tutorial on youtube and actually managed to finish it without bugging out mid way. But 3 hours later, when I wanted to check out the project again. (just want to run the app in my browser and have a look) I go to vs code and open terminal and type in npm start (newb so idk anything, is this even what i should do? ) and it gives me this
"next start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: no next.config.js https://nextjs.org/docs/messages/webpack5
Error: Could not find a production build in the 'C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
at Server.readBuildId (C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER\node_modules\next\dist\next-server\server\next-server.js:151:355)
at new Server (C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER\node_modules\next\dist\next-server\server\next-server.js:3:120)
at NextServer.createServer (C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER\node_modules\next\dist\server\next.js:1:2935)
at async C:\Users\Eric\Downloads\New folder\portfolio_website-STARTER\node_modules\next\dist\server\next.js:1:3360
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio_nextjs#0.1.0 start: next start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio_nextjs#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! C:\Users\Eric\AppData\Roaming\npm-cache_logs\2022-03-28T02_41_25_297Z-debug.log"
I can't even begin to decipher with all that was. this is why i'm having so much trouble with React, it's always a complete wall of text... can someone please explain what's going on?
Sorry i can't comment due to my low reputation but I'll be explaining Amadan's comment.
Try to read the error message. It literally says try building your app.
As newbies, we may be confused by the meaning of "build". You can refer this as "compile" for quick analogy. (for the sake of quick analogy as you may be familiar with compile)
The message itself recommend you to build your app with 'next build'. Try running the command 'next build' to your terminal and see what happen.
'npm start' (an alias for 'npm run start') itself may not include building the project first. Depending on your scripts in package.json file: you can try 'npm run build' (in case your tutorial includes this).
See the docs for more information: https://docs.npmjs.com/cli/v8/commands
Also read more about building apps: https://create-react-app.dev/docs/production-build

Error when running SvelteKit’s skeleton app locally

I am very new to programming and I have chosen to learn sveltekit. I am following this YouTube tutorial however he lost me when my skeleton project was not working!
Here is the output that I received in the terminal `$ npm run dev
client#0.0.1 dev /home/runner/svelte-chat/client
svelte-kit dev
file:///home/runner/svelte-chat/client/node_modules/#sveltejs/kit/dist/cli.js:861
https = https || !!vite_config.server?.https;
^
SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client#0.0.1 dev: svelte-kit dev
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client#0.0.1 dev 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/runner/.npm/_logs/2021-11-30T00_11_38_289Z-debug.log `
Any help at all is appreciated as I am a total beginner. I am using a MacBook Pro 13” running MacOS Monterey.
#SvelteNewbie.
Please take time to properly display the code and the error messages in your post.
The solution to your problem is to simply update your node version (please perform background research before posting your question to stack overflow).
To update your node version, refer to a similar question.
Hope this helps and enjoy your programming journey!

Failed to get remote.origin.url task must either be run in a git repository with a configured origin remote or must be configuredwith the 'repo option

In my weather-app I am using npm run deploy command in terminal
But it gives this error:
Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the "repo" option).
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! weather_app#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the weather_app#0.1.0 deploy 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/pankaj/.npm/_logs/2021-11-22T19_38_21_874Z-debug.log
Also I don't know which command should i write to get access to my git repository which is already pushed on my github account...
I had the same issue. I solved it by putting the following commands in the terminal: git init, get remote add origin (copy and paste the url from your github repository here, the parentheses are not needed), and then npm run deploy
I cloned the repo again, did npm run deploy and it worked for me!
I had the same issue. I believe it was because I forgot to run "git init" at the start of development. I just cloned my repository and it sorted itself out.
I had this issue too...:
Initially I had my project on external hard disk so I made a local copy of my project and tried the "npm run deploy" command again and it worked for me. (Just make sure your remote origin is correct).
I hope this helps.

sysmlink error when installing tensorflow/tfjs-node

I'm trying to install #tensorflow/tfjs-node#3.2.1 (latest).
I have follow a lot of other questions I saw regarding such problems but haven't found an answer for this specific issue.
I have installed visual studio with the requested build tools.
node 14.15.5
Tried with and without the flag.
This is the output of the install command:
$ npm install #tensorflow/tfjs-node --build-from-source
npm WARN deprecated node-pre-gyp#0.14.0: Please upgrade to #mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the #mapbox scoped package will recieve updates in the future
> #tensorflow/tfjs-node#3.2.0 install C:\Users\dark_\Desktop\projects\tfjs2\node_modules\#tensorflow\tfjs-node
> node scripts/install.js
CPU-windows-3.2.0.zip
* Downloading libtensorflow
* Building TensorFlow Node.js bindings
symlink ./lib/napi-v7 failed: null
npm WARN tfjs2#1.0.0 No description
npm WARN tfjs2#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #tensorflow/tfjs-node#3.2.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #tensorflow/tfjs-node#3.2.0 install 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\dark_\AppData\Roaming\npm-cache\_logs\2021-02-27T18_14_41_492Z-debug.log
After spening a day trying the usual suspects (node-gyp reinstall as global, windows building tools (re)install as global, parameter settings, etc) I've debugged the install script and found an error in it: after the symlink stuff, the author didn't check the "error" variable, and went straight to process.exit(1)
After I tore out my hair, I've found that the solution is on it's way:
https://github.com/tensorflow/tfjs/commit/2e745c8b6efe5ffc396a86cfc50347e629091248
It has been commited to the main branch (2021.02.26), so probably we'll see it in v3.3.0, or v3.2.x
Now the problem is, that if you just do a simple npm install #tensorflow\tfjs-node, the installer sees it as an error, and deletes the whole downloaded directory in node_modules. You COULD prevent the whole thing by:
EXECUTING npm install #tensorflow/tfjs-node --ignore-scripts
THEN correcting the error by hand in the install script (check the commit at the above link) and
RUNNING npm rebuild #tensorflow/tfjs-node --build-from-source.
I needed to restart VSCode, because it had difficulties picking up the references. But if you don't want to mess arround, go back to the v2.x branch for the time being.

create-react-app running issue even after just created it

*npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! github#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the github#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:*
or sometimes I am different kind of errors just after creating the app. which means no modifications to the default automatic generated project.
and I managed to solved it.
the issue seems to be with my Yarn. incomplete uninstall or something like that. can't solve it by just reinstalling Yarn or uninstall it again. because of that, NPM create-react-app also create bugs, which IDK how.
but the solution is amazing, I just created the project in a different folder. trust me I'm not lying , different location do works in NPM. so I believe I need to format my computer to solve this 100%.
The cause maybe due to I have installed create-react-app via NPM globally and tries to install Yarn create-react-app.
anyway, by using a different folder location, my issue was fixed completely.

Resources