Cannot create a new React application with create-react-app - javascript

I encountered this problem when creating a new React application (after executing the npx create-react-app my-app command):
➤ YN0000: ┌ Resolution step
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
_r [RequestError]: read ECONNRESET
at ClientRequest.<anonymous> (/home/aldaspan/.yarn/releases/yarn-3.1.1.cjs:154:14361)
at Object.onceWrapper (node:events:510:26)
at ClientRequest.emit (node:events:402:35)
at ClientRequest.o.emit (/home/aldaspan/.yarn/releases/yarn-3.1.1.cjs:149:59453)
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:164:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:211:20) {
code: 'ECONNRESET',
timings: {
start: 1639471914529,
socket: 1639471914529,
lookup: 1639471914530,
connect: 1639471922067,
secureConnect: undefined,
upload: undefined,
response: undefined,
end: undefined,
error: 1639471922468,
abort: undefined,
phases: {
wait: 0,
dns: 1,
tcp: 7537,
tls: undefined,
request: undefined,
firstByte: undefined,
download: undefined,
total: 7939
}
}
}
Node.js v17.2.0
Aborting installation.
yarnpkg add --exact react react-dom react-scripts cra-template --cwd /home/aldaspan/galog/react-shop has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
Operating system: Ubuntu 21.10,
Node -v: v17.2.0,
nodejs --version: v12.22.5,
npm -v: 8.1.4
I am new to React, and I have been looking for this problem for several days, but I haven't found a real solution yet.
After lowering the Node (sudo n 16.13.1) version, it prompts other errors:
YN0000: Done with warnings in 5m 4s
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'react-scripts/scripts/init.js'
Require stack:
- /home/aldaspan/react-shop/[eval]
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at [eval]:2:20
at Script.runInThisContext (node:vm:129:12)
at Object.runInThisContext (node:vm:305:38)
at node:internal/process/execution:75:19
at [eval]-wrapper:6:22
at evalScript (node:internal/process/execution:74:60) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/aldaspan/react-shop/[eval]' ]
}
Aborting installation.
node has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.

First make sure you are using the recommended version of nodejs. And for that you could use the n package from npm:
npm install n -g
n stable
// if one of the above commands does not pass, you could make use of sudo
sudo npm install n -g
sudo n stable
If you have installed globally create-react-app, which you shouldn't since we now use npx,
go ahead and remove it:
npm uninstall -g create-react-app
// if it does not pass, you could make use of sudo
sudo npm uninstall -g create-react-app
After fallowing the above steps, delete the project you attempted to create and start over with:
npx create-react-app my-app

Related

nodejs returns Error read ECONNRESET after npm run build JavaScript

environment
OS:window10
node:19.6.1
npm: 9.5.0
https://github.com/geolonia/japanese-addresses
as im trying to run this project using the steps in its READ.me file
$ git clone git#github.com:geolonia/japanese-addresses.git
$ cd japanese-addresses
$ npm install
$ npm run build # 元データのダウンロードと latest.csv 及び latest_gaiku.csv の作成を行います
when running npm run build, it was running without a problem at first but after a long run,
it return error below
04: waiting for nlftp_mlit_180a_04.csv...
node:events:490
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on ClientRequest instance at:
at TLSSocket.socketErrorListener (node:_http_client:496:9)
at TLSSocket.emit (node:events:512:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4077,
code: 'ECONNRESET',
syscall: 'read'
}
however, with the same code and procedure,
i was having no problem while running with my macos pc and it is running faster than under window10 environment.
Attemps to solve the issue:
npm -g config delete proxy
npm -g config delete https-proxy
npm config set registry https://registry.npmjs.org/
but nothing changed.
what are the probable causes for this to happen?

node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'side-channel'. When I run "npm start"

I encountered this error when I run npm start to view my react app.
> react-scripts start
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'side-channel'
Require stack:
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\qs\lib\stringify.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\qs\lib\index.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\node_modules\express\lib\middleware\query.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\node_modules\express\lib\application.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\node_modules\express\lib\express.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\node_modules\express\index.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\webpack-dev-server\lib\Server.js
- C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\USER-PC\Documents\Projects\frontend\Info_site\node_modules\qs\lib\stringify.js:3:22)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\qs\\lib\\stringify.js',
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\qs\\lib\\index.js',
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\lib\\middleware\\query.js',
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\lib\\application.js',
ules\\express\\lib\\application.js',
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\lib\\express.js',
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\lib\\express.js',
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\node_modules\\express\\index.js',
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\webpack-dev-server\\lib\\Server.js',
'C:\\Users\\USER-PC\\Documents\\Projects\\frontend\\Info_site\\node_modules\\react-scripts\\scripts\\start.js'
]
}
And then I tried to install the module with this command:
npm i side-channel
I still got an error:
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER-PC\AppData\Local\npm-cache\_logs\2022-10-04T15_30_26_716Z-debug-0.log
What could possibly be the problem? I ran the start command just after installing the dependencies with 'npm install' command.
It worked now. I had to delete the yarn.lock in my project, after deleting the node_modules file, then I ran the command again: npm install
You can try removing node_modules and reinstalling all modules with npm install
To show your modules as of npm 7 for windows:
Global modules: npm ls --link --global
Local modules: npm ls --link
To unistall package run
npm uninstall <module_name>
To install just run
npm install <module_name>
The best solution i have found for this problem is to uninstall and reinstall react.
This will uninstall React
to make sure it's there and show dependencies run
npm ls -g --depth=0
output:
F:\Dev\NodeJS\node22
+-- create-react-app#5.0.1
+-- express#4.14.0
to uninstall run
npm unistall -g create-react-app
to install run
npm install -g create-react-app

Can't start webpack development server

I am new on es6. I followed a blog Beginner’s Guide To Setup ES6 Development Environment. I completed all of the process step-by-step. Then the step comes up to install the webpack development server. Then I write this code to cmd - npm run build. I get this error:
λ npm run build
-> jj#1.0.0 build C:\Users\galib\Desktop\jj
-> webpack-dev-server
The CLI moved into a separate package: webpack-cli
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
-> When using yarn: yarn add -D webpack-cli
internal/modules/cjs/loader.js:888
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- C:\Users\galib\AppData\Roaming\npm\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\galib\AppData\Roaming\npm\node_modules\webpack-dev-server\bin\web
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\galib\\AppData\\Roaming\\npm\\node_modules\\webpack-dev-server\\bin\\webpack-dev-serv
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jj#1.0.0 build: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jj#1.0.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! C:\Users\galib\AppData\Roaming\npm-cache\_logs\2021-06-08T18_22_59_337Z-debug.log
The article you read was probably written before Webpack's cli was moved to webpack-cli, so you might need one small extra step.
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
-> When using yarn: yarn add -D webpack-cli
Run npm i -D webpack-cli and then you can use the Webpack CLI.

Node.js with parse.com (ParseOpenSource javascript sdk) installed - fails on AWS eb deploy

I am trying to 'eb deploy' a node.js with javascript sdk addition.
It works fine locally but every time I have tried to - eb deploy- it I get this in the logs
npm ERR! npm bugs node-express
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls node-express
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log
> node-express#0.0.0 start /var/app/current
> node main.js
{ [Error: ENOENT: no such file or directory, open '.env'] errno: -2, code: 'ENOENT', syscall: 'open', path: '.env' }
module.js:327
throw err;
^
Error: Cannot find module 'parse/node'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/app/current/api/common/parse.js:3:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
...npm ERR! code ELIFECYCLE
npm ERR! node-express#0.0.0 start: `node main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-express#0.0.0 start script 'node main.js'.
npm ERR! This is most likely a problem with the node-express package,
I have repeatedly tried
npm install express --save
and yes I have also run npm install parse (it all works fine locally).
To no avail. Why would it all work like a charm locally but not on AWS EB ?
-Thanks for any clues.
Not sure if this will help someone. Ultimately I solved this by
'npm install moduleName --save' on all of my modules. One by one.
Still not sure why the site worked locally ?
-best of luck.

Kadira/mup.js Error: Cannot find module 'fbjs/lib/invariant'

$ npm -v
3.10.3
$ node -v
v4.5.0
I tried to setup mup.js from kadirahq/mup but after
cd .deploy
mup setup
I don't get any status of whether it setup properly or not, just returns next line as opposed to mupx setup which did provide SUCCESS MUPX setup messages along the way.
Can anyone provide actual real example of a working mup.js that is deployed to their own self hosting (no digital ocean examples etc) please as I already did that.
a working mup.js that has real mongo_url, mongo_oplog, root_url because I have tried but none successful yet.
EDIT:
Mac OSX
Meteor 1.4.1.1
Added example of mysparkapp/.deploy/mup.js:
module.exports = {
servers: {
one: {
host: 'IP address',
username: 'root',
password: 'xxxxxx!'
//pem: "/Users/seb/.ssh/id_rsa"
// or leave blank for authenticate from ssh-agent
}
},
meteor: {
name: 'myappdemo',
//path: '..',
path: '/Users/seb/myappdemo/',
docker: {
image: 'abernix/meteord:base'
},
servers: {
one: {}
},
buildOptions: {
serverOnly: true
},
env: {
PORT: 63830,
ROOT_URL: 'http://localhost:63830',
MONGO_URL: 'mongodb://localhost/meteor'
},
//dockerImage: 'kadirahq/meteord'
dockerImage: 'abernix/meteord:base',
deployCheckWaitTime: 60
},
mongo: {
oplog: true,
port: 27017,
servers: {
one: {},
},
},
};
then
$ mup setup
Started TaskList: Setup Docker
[138.68.141.215] - setup docker
[138.68.141.215] - setup docker: SUCCESS
Started TaskList: Setup Meteor
[138.68.141.215] - Setup Environment
Started TaskList: Setup Mongo
[138.68.141.215] - setup environment
[138.68.141.215] - setup environment: SUCCESS
[138.68.141.215] - copying mongodb.conf
[138.68.141.215] - copying mongodb.conf: SUCCESS
[138.68.141.215] - Setup Environment: SUCCESS
Started TaskList: Start Mongo
[138.68.141.215] - start mongo
[138.68.141.215] - start mongo: SUCCESS
$ mup deploy
Building App Bundle Locally
Started TaskList: Pushing Meteor
[138.68.141.215] - Pushing Meteor App Bundle to The Server
[138.68.141.215] - Pushing Meteor App Bundle to The Server: SUCCESS
[138.68.141.215] - Pushing the Startup Script
[138.68.141.215] - Pushing the Startup Script: SUCCESS
Started TaskList: Configuring Meteor Environment Variables
[138.68.141.215] - Sending Environment Variables
[138.68.141.215] - Sending Environment Variables: SUCCESS
Started TaskList: Start Meteor
[138.68.141.215] - Start Meteor
[138.68.141.215] - Start Meteor: SUCCESS
[138.68.141.215] - Verifying Deployment
[138.68.141.215] x Verifying Deployment: FAILED
-----------------------------------STDERR-----------------------------------
: "1.2.8"
}
npm WARN meteor-dev-bundle#0.0.0 No description
npm WARN meteor-dev-bundle#0.0.0 No repository field.
npm WARN meteor-dev-bundle#0.0.0 No license field.
=> Starting meteor app on port:80
/bundle/bundle/programs/server/node_modules/fibers/future.js:280
throw(ex);
^
Error: Cannot find module 'fbjs/lib/invariant'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/bundle/bundle/programs/server/npm/node_modules/react/lib/PooledClass.js:16:17)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Module.Mp.load (/bundle/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/reify/node/runtime.js:16:23)
at Function.Module._load (module.js:300:12)
=> Redeploying previous version of the app
-----------------------------------STDOUT-----------------------------------
To see more logs type 'mup logs --tail=50'
-----------
Then
$ npm install invariant warning --save
x Verifying Deployment: FAILED
-----------------------------------STDERR---------------------------- -------
erm"
npm ERR! node v4.4.7
npm ERR! npm v3.10.5
npm ERR! code ELIFECYCLE
npm ERR! meteor-dev-bundle#0.0.0 install: `node npm-rebuild.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-dev-bundle#0.0.0 install script 'node npm-rebuild.js'.
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 meteor-dev-bundle package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node npm-rebuild.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs meteor-dev-bundle
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls meteor-dev-bundle
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /bundle/bundle/programs/server/npm-debug.log
=> Redeploying previous version of the app
-----------------------------------STDOUT-----------------------------------
To see more logs type 'mup logs --tail=50'
----------------------------------------------------------------------------
But later Error: Cannot find module 'fbjs/lib/invariant' reappears again???
SOLUTION (for me anyway)
$npm install -g bcrypt-nodejs &&
$npm uninstall -g bcrypt
Make sure you use a full path to your apps location - /users//.. mup.js doesn't like ~/
Otherwise post an example of your mup.js and I'll let you know where you are going wrong.

Categories

Resources