Error while running npm start in react js - node.js

I have created a react project using npx
npx create-react-app react-authentication
After that when I run
npm start
It throws an error saying:
internal/modules/cjs/loader.js:456
throw e;
^
Error: Cannot find module '/home/astraCreateDataProperty/react-authentication/node_modules/es-abstract/2020/CreateDataProperty.js'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:929:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:922:15)
at resolveExports (internal/modules/cjs/loader.js:450:14)
at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/home/astra*/react-authentication/node_modules/object.getownpropertydescriptors/implementation.js:3:26)
at Module._compile (internal/modules/cjs/loader.js:1085:14) {
code: 'MODULE_NOT_FOUND',
path: '/home/astra*/react-authentication/node_modules/es-abstract/package.json'
}
I tried some methods to solve this like
rm -rf node_modules
rm -rf package-lock.json
npm cache clean --force
npm install
But still, the same error persists. What is the cause of this error?

Related

Cannot Find Module ' Webpack' Bigcommerce

I am trying to connect to Bigcommerce Stencil. I am able to pull and download but having trouble with pushing as I kept getting a no webpack module error. I have tried several things like google for hours but no lack.
rm -rf node_modules
rm -f package-lock.json
npm install
npm install --save-dev webpack
npm install --save-dev webpack-dev-server
npm install --legacy-peer-deps
npm install --save --legacy-peer-deps
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'webpack'
Require stack:
- C:\Users\z\downloads\bigcommerce\skeyndor\stencil.conf.js
- C:\Users\z\AppData\Roaming\npm\node_modules\#bigcommerce\stencil-cli\lib\BuildConfigManager.js
- C:\Users\z\AppData\Roaming\npm\node_modules\#bigcommerce\stencil-cli\lib\stencil-start.js
- C:\Users\z\AppData\Roaming\npm\node_modules\#bigcommerce\stencil-cli\bin\stencil-start.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.<anonymous> (C:\Users\z\downloads\bigcommerce\skeyndor\stencil.conf.js:1:15)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\z\\downloads\\bigcommerce\\skeyndor\\stencil.conf.js',
'C:\\Users\\z\\AppData\\Roaming\\npm\\node_modules\\#bigcommerce\\stencil-cli\\lib\\BuildConfigManager.js',
'C:\\Users\\z\\AppData\\Roaming\\npm\\node_modules\\#bigcommerce\\stencil-cli\\lib\\stencil-start.js',
'C:\\Users\\z\\AppData\\Roaming\\npm\\node_modules\\#bigcommerce\\stencil-cli\\bin\\stencil-start.js'
]
}
npm i --save webpack
Try installing webpack or add it to package.json

AppData-Roaming-npm is empty! 'ERR_DLOPEN_FAILED'

I am trying to create a new Hardhat project. Hardhat gives me some pre-created sol files and some scripts. I am just trying to compile this pre-created project, but an error occurred.
\\?\C:\Users\myuser\Desktop\SolidityProjects\emptyhardhatfinal\node_modules\#nomicfoundation\solidity-analyzer-win32-x64-msvc\solidity-analyzer.win32-x64-msvc.node at Object.Module._extensions..node (node:internal/modules/cjs/loader:1210:18)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\myuser\Desktop\SolidityProjects\emptyhardhatfinal\node_modules\#nomicfoundation\solidity-analyzer\index.js:69:29) at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12) {
code: 'ERR_DLOPEN_FAILED'
}
npm init -y
npm i --dev hardhat
npx hardhat and create a JavaScript project
npm i --dev #nomicfoundation/hardhat-toolbox
`npx hardhat compile``` the error above occurred.
My Node.js version is v16.17.0.
User variables for my.user = C:\Users\myuser\AppData\Roaming\npm
System variables = C:\Program Files\nodejs\
I realized that the "AppData\Roaming\npm" folder is empty. But inside another PC that this project worked well is not empty; there is a "node_modules" folder.
What is the problem and how can I solve this?
Try deleting the node_modules folder and see if the project uses NPM or Yarn and run the npm i or Yarn according to it.

npm start (yarn start) error. cannot find #babel/register

I creact app using react. I usually use yarn start to run my app.
Error messege is "cannot find #babel/register" but there is on the package.json.
In my package.json
"#babel/register": "^7.6.2"
my index.js
require('#babel/register');
module.exports = require('./server.js');
Error
> reactjs-simple-boilerplate#1.0.0 start
> node src/server/index.js
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '#babel/register'
Require stack:
- /Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/mk/kr/kr-application-bd786050/kr-site/src/server/index.js'
]
}
npm install --save-dev #babel/register is not works for me.
After run this code, I got npm ERR! code EINTEGRITY
Not sure I can help 100% with the given information, but try running the following:
rm -rf node_modules package-lock.json yarn.lock; npm i
That will not only remove your modules, but it'll also remove eventual lock files which are used as conformity for your module versions; It could happen they mismatched versions between installations causing the above error, thus by removing and reinstalling you should solve the problem.
If that's not the case, you might have something off on your package.json, which you'd need to share in order to debug further

Error: Cannot find module 'binary-extensions'

I am trying to use reactjs on local system.
I followed the official documentation of reactjs and was trying its tutorial on tic tac toe.
For local development environment I followed all the steps but when I try to run npm start I am getting below error
module.js:549
throw err;
^
Error: Cannot find module 'binary-extensions'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/Documents/my-
app/node_modules/chokidar/node_modules/is-binary-path/index.js:3:24)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
I am using Node v8.11.3 and npm v5.6.0
FYI I have installed binary-extensions using npm i binary-extensions but I am still getting same error.
Somehow, your project has lost track of the binary-extensions module.
The fix is simple.
In your project, delete node_modules/ and package-lock.json.
macOS / Linux:
rm -rf node_modules/
rm package-lock.json
Windows:
rmdir node_modules/
rm package-lock.json
Then,
npm install
This will resolve the issue.

ng serve build error after npm install

I'm getting the following error in my angular2 app with cmd ng serve after deleting the node_modules directory and building it new with npm install.
Error: Cannot find module 'common-tags'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/models/config.js:8:21)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
also npm install common-tags to add it manually does not work
Looks like you should update your angular-cli and clean the cache
npm uninstall -g #angular/cli
npm cache clean --force
npm install -g #angular/cli#latest
npm install

Resources