NPM Run Watch is Not Working For React Project - javascript

Hello Im trying to use NPM Run Watch so I can see localhost:3000 for my React Project but I'm getting a weird error so I don't even know where to begin.
Rubens-iMac:react-redux rubenesquivel$ npm run watch
> CodingPhase-StarterKit#1.0.0 watch /Users/rubenesquivel/Dropbox/Web Development/Web Development Courses/Coding Phase/react-redux
> gulp
fs.js:45
} = primordials;
^
ReferenceError: primordials is not defined
at fs.js:45:5
at req_ (/Users/rubenesquivel/Dropbox/Web Development/Web Development Courses/Coding Phase/react-redux/node_modules/natives/index.js:143:24)
at Object.req [as require] (/Users/rubenesquivel/Dropbox/Web Development/Web Development Courses/Coding Phase/react-redux/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/Users/rubenesquivel/Dropbox/Web Development/Web Development Courses/Coding Phase/react-redux/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! CodingPhase-StarterKit#1.0.0 watch: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the CodingPhase-StarterKit#1.0.0 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! /Users/rubenesquivel/.npm/_logs/2021-02-20T22_29_40_150Z-debug.log
Rubens-iMac:react-redux rubenesquivel$
Not sure if anyone is familiar with this guy but I'm using codingphase starter package and before I did npm run watch I installed gulp I had some errors but I fixed using commands from stack over flow so Im worried maybe I did something to cause this on accident. I hope this makes sense.

I think I saw this error before:
First, make sure you are in the root directory of the project
Second, make sure you did run npm install
Third and most importantly, check if this project is inside another project. Meaning that you should go up level by level and check if you have a package.json file and some node_modules installed in any one of these directories:
/Users/rubenesquivel/Dropbox/Web Development/Web Development Courses/Coding Phase/
Please, let me know if this does not solve your problem

Ok I figured out what was causing the issue. The main folder I put the react project in had spaces in it. For Example I had it called Calendar web app and should have called it calendar-web-app. Yeah i know this was a rookie mistake but figure ill let everyone know in case it happens to anyone else. Thanks to everyone who took the time to help out.

Related

npm warn and npm start issues

I recently started coding again and I've got some issues regarding React/NodeJS (don't know which one is responsible for that)
So first things first, I installed VSCode, all clean, no errors no nothing. Then I installed NodeJS.
Now I'm just trying to create a React project for my own. I didn't install React at all as it seems it came by default after installing NodeJS. Now comes the ugly stuff.
Whenever I use the "npx create-react-app something-name" I get the following:
$ npx create-react-app demo
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
I also get some audit errors/vulnerabilities but maybe they are not so important as they get fixed after I use "audit fix --force".
So let's say that we just want to start the project.
I use cd something-name and npm start and I get this:
$ npm start
> demo#0.1.0 start
> react-scripts start
The system cannot find the path specified.
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'D:\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
If anybody could help me remove those warnings from NPM and also let me know what should I do in order to start my project would be highly appreciated!
Hello there sir here are some possible fixes according to a previous question
Error: Cannot find module '\react-scripts\bin\react-scripts.js'
Check your package.json file in your project folder
delete node_modules, and package.lock.json reinstall them by
npm install
Check if your project path has a special character which is "&" just remove it
Try running a production build
//makes the production build
npm build
// runs the production build
npm run build
Finally try reinstalling node js on your system that could be the issue aswell
https://nodejs.org/en/
check your node version and make sure is updated.
remove the node-modules ()
npm install
npm start

The system cannot find the path specified. internal/modules/cjs/loader.js:834

im working on a project using vuejs cli and when i type this in the terminal 'npm run serve' it should give me a localhost to past in a browser to view my work but i keep getting multiple errors:
> root#0.1.0 serve E:\MILAD\VUE.JS\TRAINING & projects\log in CLI
> vue-cli-service serve
The system cannot find the path specified.
internal/modules/cjs/loader.js:834
throw err;
^
Error: Cannot find module 'E:\MILAD\VUE.JS\#vue\cli-service\bin\vue-cli-service.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! root#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the root#0.1.0 serve 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\Bannourah Gang\AppData\Roaming\npm-cache\_logs\2020-10-15T00_03_44_083Z-debug.log
and something saying: This is probably not a problem with npm. There is likely additional logging output above.
i dont know what that means and i dont know why i appears.
thanks in advance.
The issue is because it is not able to find the .js file inside the folder. Even I faced the same issue and I fixed it, below are the steps which I performed
download notepad++
Open nodepad++ -> file -> new -> write your code -> save with ".js" extension("save as Type" must be javaScript file)
open cmd-> node "fileName.js"
Screenshot

Cannot find module 'internal/fs' not working as per the existing solutions

I'm getting the following issue all the time while going to run my project. Even after downgraded my node version to 8.4.0 (npm version 5.3.0) still getting the same issue. I know there are so many solutions given like after removing the node_modules to run npm cache clean --force and then again npm install but this solution is not working as well.
PFB, the error:
npm start
m> subhojits-components#0.0.1 start
/home/subhojit/Desktop/my_project
> node server/index
Unspecified environment, booting dev server
Booting dev server....
module.js:491
throw err;
^
Error: Cannot find module 'internal/fs'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at evalmachine.<anonymous>:40:20
at Object.<anonymous>
(/home/subhojit/Desktop/my_project/node_modules/express-
handlebars/node_modules/graceful-fs/fs.js:11:1)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! subhojits-components#0.0.1 start: `node server/index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the subhojits-components#0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
Please let me know if there are anymore solutions. Any help would be appreciated.
Note: I'm using graceful-fs version 4.0.0
hi please import the graceful-fs library
like
import {userDefinedName} from 'graceful-fs';
hope it will help you.
or Click On the below Link.
graceful-fs
I have seen this error on external Apple engine.
Uninstalling the currently active version of node.js with nvm
So uninstall npm:
nvm deactivate
nvm uninstall <<version>>
Install stable version
nvm install <<version>>
nvm install 10.15.3
Install Angular/Cli (exemple)
npm install #angular/cli
npm link #angular/cli
Wish, it works.

What else do I need to try to resolve this npm start error?

I have tried to resolve this by reading other stack overflow entries before posting, but the same error message keeps showing up.
I am trying to run a Javascript program that integrates ReactJS. It worked for a while and every time I would type "npm start" it would automatically bring up the webpage template in the browser. Now it gives me the following error(s):
jMBP:project javen$ npm start
> react-box#0.1.0 start /Users/javen/Desktop/project
> node scripts/start.js
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'react-dev-utils/prompt'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/sland/Desktop/project/scripts/start.js:20:14)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-box#0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-box#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! /Users/javen/.npm/_logs/2018-09-27T01_24_06_237Z-debug.log
I have the following installed:
node -v: v10.9.0
npm -v: 6.4.1
I have tried the following:
npm install --save-dev react-dev-utils
npm install -g npm#latest
rm -rf node_modules
npm install //this threw a lot of errors
In the package.json file, for react-dev-utils it says, "react-dev-utils": "^5.0.2" Also, I do not know if this matters, but in the process of trying fixing this, a package-lock.json file has shown up in my project folder. The "prompt" var the error is referring to is the start.js folder: var prompt = require('react-dev-utils/prompt');
I have read that downgrading to an older version of node can sometimes work. If this is the case, which version is best, and how do I do this? Any advice appreciated.
I think npm install --save-dev react-dev-utils commands generally solves the issue. If not then updating your configs to match the latest create-react-app will fix this issue.

npm run build throws code ELIFECYCLE after installing all dependencies for lodash

I have been trying to run the lodash library on my system.Here is the link to the library .link to lodash github
. I forked the repo and then cloned it on my system .I ran npm install ad installed all the dependencies in the package.json by running npm install and it worked fine .After that i tried npm run build as shown on github page and I am getting this error .
module.js:549
throw err;
^
Error: Cannot find module '/home/satya/lodash/lib/main/build-dist.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lodash#4.17.4 build:main: `node lib/main/build-dist.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lodash#4.17.4 build:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
How do I resolve the above so that I can introduce console logs and start reading .
lodash's master branch is simply broken. From CONTRIBUTING.md:
🚧 Notice 🚧
Pardon the mess. The master branch is in flux while we
work on Lodash v5. This means things like npm scripts, which we
encourage using for contributions, may not be working. Thank you for
your patience.
Simply use the latest development branch, which is 4.17 as of now.
On another note, to understand which branches are under active development on any project on GitHub, go to https://github.com/<user or organization name>/<project name>/branches/active.

Categories