yarn start command failed with exit code 127 - node.js

Every time I try to start my project as usual using "yarn start" I get the "Command failed with exit code 127" error. I've realised I started to get this error once I've updated my iOS to Monterey v12.6.1 . My node version is not compatible with the yarn it seems like.
What have I tried to fix this:
I have tried to upgrade/update my node version.
I have uninstalled manually node/npm and yarn and reinstall them back with node version 16.0.0
I have deleted the node_modules and package_lock.json
I have had run the command "yarn" and every other update/upgrade command
Everything that I have tried failed.
This is the yarn error log:
Yarn version:
1.22.10
Node version:
15.7.0
Platform:
darwin x64
Trace:
Error: getaddrinfo ENOTFOUND registry.yarnpkg.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:69:26)
npm manifest:
{
"name": "web",
"version": "0.1.0",
"homepage": "https://danibis.github.io/",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"cors": "^2.8.5",
"express": "^4.17.2",
"focus-trap-react": "^8.9.1",
"leaflet": "^1.8.0",
"node-sass": "^6.0.1",
"nodemailer": "^6.7.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-leaflet": "^4.0.0",
"react-scripts": "4.0.3",
"styled-components": "^5.3.3",
"web-vitals": "^1.0.1",
"webpack-hot-middleware": "^2.25.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "yarn run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": [
">0.2%",
"not dead",
"not op_mini all"
]
}
yarn manifest:
No manifest
Lockfile:
No lockfile
Any other idea how to sort this out would be much appreciated.
Thank you for your time!

Related

Build React JS docker image npm install error Could not resolve dependency and Conflicting peer dependency: react#17.0.2

can someone tell me the problem with my Dockerfile , i tried build image react js with docker and somehow it always show error when step run npm install
dockerfile
FROM node:18-alpine
WORKDIR /app
COPY package.json .
COPY package-lock.json .
#COPY . .
#RUN npm install -g npm#8.19.3
#RUN npm install react-scripts
#RUN npm ci
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "run", "start"]
package.json
{
"name": "app-test",
"version": "0.1.0",
"private": true,
"dependencies": {
"#emotion/react": "^11.10.4",
"#emotion/styled": "^11.10.4",
"#fontsource/roboto": "^4.5.8",
"#mui/icons-material": "^5.10.9",
"#mui/material": "^5.10.8",
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"blueimp-md5": "^2.19.0",
"file-saver": "^2.0.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-excel-export": "^1.0.6",
"react-excel-renderer": "^1.1.0",
"react-redux": "^8.0.4",
"react-router-dom": "^6.4.2",
"react-scripts": "5.0.1",
"redux": "^4.2.0",
"sass": "^1.55.0",
"web-vitals": "^2.1.4",
"xlsx": "^0.18.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"homepage": ".",
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
and i have very very long package-lock.json
i tried to change npm install to npm install -g npm#8.19.3 from npm suggestion, and after i change dockerfile, it success build image, but when i tried to run container, it says
> app-test#0.1.0 start
> react-scripts start
sh: react-scripts: not found
can anyone tell me where am i wrong ?

This version of µWS is not compatible with your Node.js build: Error: node-loader. while running "truffle console"

I'm working on a Blockchain project where I use Truffle. when I run the Truffle Console command I face this issue.
Complete Log:
This version of µWS is not compatible with your Node.js build:
Error: node-loader:
Error: The specified module could not be found.
C:\Users\sudda\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\dist\node/3jj9vE3p.node
Falling back to a NodeJS implementation; performance may be degraded.
Package.json
{
"name": "nft-marketplace",
"version": "0.1.0",
"description": "An NFT Marketplace",
"author": "clarionnorth#gmail.com",
"dependencies": {
"#metamask/detect-provider": "^1.2.0",
"#openzeppelin/contracts": "^4.3.1",
"babel-polyfill": "6.26.0",
"babel-preset-env": "1.7.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-stage-2": "6.24.1",
"babel-preset-stage-3": "6.24.1",
"babel-register": "6.26.0",
"bootstrap": "4.3.1",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"chai-bignumber": "3.0.0",
"mdb-react-ui-kit": "^1.3.0",
"mdb-ui-kit": "^3.9.0",
"react": "16.8.4",
"react-bootstrap": "1.0.0-beta.5",
"react-dom": "16.8.4",
"react-scripts": "2.1.3",
"truffle": "5.0.5",
"web3": "1.0.0-beta.55"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
My node version is 16.14.0.
How I can remove this error/warning.
This happened to me with v19.1.0 while I run
truffle deploy --network goerli
I switched to
nvm use --lts
Now using node v18.12.1 (npm v8.19.2)
problem is resolved

Moderate severity vulnerabilities due to minimist

I'm running into a huge number of vulnerabilities. There are 583 vulnerabilities all associated with the package minimist
My package.json is as such:
{
"name": "weather-wizard",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:5000",
"dependencies": {
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.4.1",
"#testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"chart.js": "^2.9.3",
"eslint-plugin-flowtype": "^3.13.0",
"minimist": "^1.2.5",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
"react": "^16.13.0",
"react-animated-weather": "^4.0.0",
"react-chartjs-2": "^2.9.0",
"react-dom": "^16.13.0",
"react-places-autocomplete": "^7.2.1",
"react-scripts": "3.4.0",
"typescript": "^3.8.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
What is the best way to manage these vulnerabilities?
When you see some issue like this, you need to first check on the github repository if they are already notified and create an issue so they can fix it soon.
They are taking care of this in the following issue: https://github.com/facebook/create-react-app/issues/8672
Solution:
For npm users:
npm install minimist --save-dev
eg: (minimist version: 1.2.5)
Add Resolution key adjacent to dependency key into package.json file
{
"resolutions": {
"minimist": "^1.2.5"
}
}
Add below line inside script key into package.json
example:
"scripts": {
"preinstall": "npx npm-force-resolutions"
}
Remove node_modules, and then run command: npm install.
While npm audit fix fixes dependency

Running electron-build on my create-react-app app comes up with an error?

Hi I am developing an Electron-react app using create-react-app boilerplate and electron-builder to package and deploy it.
However, on running electron-builder using yarn in the CL it shows this error.
• loaded configuration file=package.json ("build" field)
• loaded parent configuration preset=react-cra
• writing effective config file=build\builder-effective-config.yaml
• packaging platform=win32 arch=x64 electron=8.0.1 appOutDir=build\win-unpacked
• default Electron icon is used reason=application icon is not set
• building target=nsis file=build\electron-react-typescript-app Setup 0.1.0.exe archs=x64 oneClick=true perMachine=false
⨯ write EPIPE stackTrace=
Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:150:25)
at writeGeneric (internal/stream_base_commons.js:141:3)
at Socket._writeGeneric (net.js:771:11)
at Socket._write (net.js:783:8)
at doWrite (_stream_writable.js:431:12)
at writeOrBuffer (_stream_writable.js:415:5)
at Socket.Writable.write (_stream_writable.js:305:11)
at Socket.Writable.end (_stream_writable.js:594:10)
at Socket.end (net.js:575:31)
at C:\Users\andrew.choi\Documents\electron-react-app\.yarn\cache\builder-util-npm-22.3.3-d8bf259145-2.zip\node_modules\builder-util\src\util.ts:193:26
at new Promise (<anonymous>)
at spawnAndWrite (C:\Users\username\Documents\electron-react-app\.yarn\cache\builder-util-npm-22.3.3-d8bf259145-2.zip\node_modules\builder-util\src\util.ts:176:10)
at NsisTarget.executeMakensis (C:\Users\username\Documents\electron-react-app\.yarn\cache\app-builder-lib-npm-22.3.3-dc71ab7fc0-2.zip\node_modules\app-builder-lib\src\targets\nsis\NsisTarget.ts:552:11)
at NsisTarget.computeScriptAndSignUninstaller (C:\Users\andrew.choi\Documents\electron-react-app\.yarn\cache\app-builder-lib-npm-22.3.3-dc71ab7fc0-2.zip\node_modules\app-builder-lib\src\targets\nsis\NsisTarget.ts:340:5)
at NsisTarget.buildInstaller (C:\Users\username\Documents\electron-react-app\.yarn\cache\app-builder-lib-npm-22.3.3-dc71ab7fc0-2.zip\node_modules\app-builder-lib\src\targets\nsis\NsisTarget.ts:278:103)
at NsisTarget.finishBuild (C:\Users\username\Documents\electron-react-app\.yarn\cache\app-builder-lib-npm-22.3.3-dc71ab7fc0-2.zip\node_modules\app-builder-lib\src\targets\nsis\NsisTarget.ts:110:7)
command not found: electron-builder
Here is my package.json file.
I am using windows 10 if that matters.
And running "yarn dist" in the command prompt opened with administrators permissions
{
"name": "electron-react-typescript-app",
"version": "0.1.0",
"private": true,
"main": "src/start.js",
"build": {
"appId": "123456789",
"directories": {
"buildResources": "assets",
"output": "build"
},
"win": {
"target": "nsis"
}
},
"dependencies": {
"#material-ui/core": "^4.8.0",
"#material-ui/icons": "^4.5.1",
"#reduxjs/toolkit": "^1.2.3",
"axios": "^0.19.2",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"electron-is-dev": "^1.1.0",
"electron-updater": "^4.2.0",
"express": "^4.17.1",
"immer": "^5.3.2",
"material-table": "^1.55.0",
"mssql": "^6.0.1",
"react": "^16.10.2",
"react-desktop": "^0.3.9",
"react-dom": "^16.10.2",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"tailwindcss": "^1.2.0"
},
"scripts": {
"electron": "cross-env NODE_ENV=dev nodemon --exec \"\"electron .\"\"",
"electron-build": "electron-builder",
"start": "cross-env BROWSER=none nodemon npm run react-start",
"react-start": "react-scripts start",
"build": "react-scripts build",
"react-test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"server": "node ./server/server --exec nodemon | pino-colada",
"dev": "run-p server react-start",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"proxy": "http://localhost:3500",
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"cross-env": "^6.0.3",
"devtron": "^1.4.0",
"electron": "8.0.1",
"electron-builder": "^22.3.2",
"electron-devtools-installer": "^2.2.4",
"electron-redux-devtools": "^0.3.4",
"electron-reload": "^1.5.0",
"express-pino-logger": "^4.0.0",
"node-env-run": "^3.0.2",
"nodemon": "^1.19.3",
"npm-run-all": "^4.1.5",
"pino-colada": "^1.5.1",
"redux-devtools-extension": "^2.13.8"
},
"description": "An Electron React App",
"repository": {
"type": "git",
"url": "git+https://github.com/Icecubelegacy/Electron-react-app.git"
},
"keywords": [
"electron"
],
"author": "Andrew Choi",
"license": "ISC",
"bugs": {
"url": "https://github.com/Icecubelegacy/Electron-react-app/issues"
},
"homepage": "./",
"postinstall": "electron-builder intall-app-deps"
}
command not found: electron-builder
This likely means that your node_modules folder doesn't have electron-builder under node_modules/.bin.
You can try running the command
yarn
which should get you electron-builder installed locally since it's listed under your devDependencies in your package.json file.
This issue has now been resolved.
I started a new project, specified the version of electron-builder as 22.3.5, ran yarn build and then ran yarn electron-pack. Then I went to my .dist folder and installed the setup exe and then was able to open the .exe application file successfully.

Deploying React app with npm run build not finding files

I currently have a directory myproject/
In myproject I have these
/src
/public
package.json
etc.
Normal stuff you'd see in a react app.
I pushed this to a server aws lightsail nodejs
I then run npm install.
After I do all this I go and run npm run build
I get this output:
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/index.js
Cannot find module: 'layouts/Admin.jsx'. Make sure this package is installed.
You can install this package by running: npm install layouts/Admin.jsx.
The files it's calling for are in the directory.
Here is package.json
{
"name": "argon-dashboard-react",
"version": "1.0.0",
"description": "React version of Argon Dashboard by Creative Tim",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/creativetimofficial/argon-dashboard-react.git"
},
"keywords": [
"react",
"reactjs",
"argon",
"argon-react",
"dashboard",
"dashboard-react",
"argon-dashboard",
"argon-dashboard-react"
],
"author": "Creative Tim",
"license": "MIT",
"bugs": {
"url": "https://github.com/creativetimofficial/argon-dashboard-react/issues"
},
"homepage": "https://demos.creative-tim.com/argon-dashboard-react/",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
"compile-sass": "node-sass src/assets/scss/argon-dashboard-react.scss src/assets/css/argon-dashboard-react.css",
"minify-sass": "node-sass src/assets/scss/argon-dashboard-react.scss src/assets/css/argon-dashboard-react.min.css --output-style compressed",
"map-sass": "node-sass src/assets/scss/argon-dashboard-react.scss src/assets/css/argon-dashboard-react.css --source-map true"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"dependencies": {
"#material-ui/core": "^4.6.1",
"#material-ui/icons": "^4.5.1",
"chart.js": "2.7.3",
"classnames": "2.2.6",
"firebase": "^6.6.2",
"firebase-admin": "^8.8.0",
"http2": "^3.3.7",
"moment": "2.24.0",
"node-sass": "4.11.0",
"nouislider": "13.1.1",
"react": "16.9.0",
"react-bootstrap-table-next": "^3.2.1",
"react-chartjs-2": "2.7.4",
"react-copy-to-clipboard": "5.0.1",
"react-data-table-component": "4.0.1",
"react-datepicker": "^2.9.6",
"react-datetime": "2.16.3",
"react-dom": "16.9.0",
"react-google-maps": "9.4.5",
"react-loading-screen": "0.0.17",
"react-router-dom": "4.3.1",
"react-scripts": "2.1.8",
"reactstrap": "7.1.0",
"recompose": "^0.30.0",
"styled-components": "^4.4.1",
"sweetalert2": "^9.5.4",
"sweetalert2-react-content": "^2.0.2"
},
"devDependencies": {
"#types/googlemaps": "3.30.18",
"#types/markerclustererplus": "2.1.33",
"#types/react": "16.8.7",
"typescript": "3.3.3333"
}
}
Any idea what's going on with this?
The problem was related to the way I was using my import paths for components.
In example, currently I have:
import UserHeader from "components/Headers/UserHeader.jsx";
The correct way to have set them was:
import UserHeader from "../../components/Headers/UserHeader.jsx";
What was throwing me off was that locally it worked.

Resources