React app taking too long to start the development server - node.js

I am using a react dashboard template from themeforest. Here is the package.json content:
{
"name": "acorn-react",
"version": "1.0.1",
"private": true,
"proxy": "http://localhost:3000",
"dependencies": {
"#emoji-mart/data": "^1.0.2",
"#fullcalendar/bootstrap": "^5.9.0",
"#fullcalendar/daygrid": "^5.9.0",
"#fullcalendar/interaction": "^5.9.0",
"#fullcalendar/react": "^5.9.0",
"#fullcalendar/timegrid": "^5.9.0",
"#glidejs/glide": "^3.4.1",
"#reduxjs/toolkit": "^1.6.0",
"#testing-library/jest-dom": "^5.13.0",
"#testing-library/react": "^11.2.7",
"#testing-library/user-event": "^13.1.9",
"#yaireo/tagify": "^4.12.0",
"autosuggest-trie": "^2.1.1",
"axios": "^0.21.1",
"axios-mock-adapter": "^1.19.0",
"chart.js": "^3.5.1",
"chartjs-adapter-luxon": "^1.0.0",
"chartjs-plugin-crosshair": "^1.2.0",
"chartjs-plugin-datalabels": "^2.0.0",
"chartjs-plugin-streaming": "^2.0.0",
"clamp-js": "^0.7.0",
"classnames": "^2.3.1",
"date-fns": "^2.22.1",
"emoji-mart": "3.0",
"formik": "^2.2.9",
"fuse.js": "^6.4.6",
"intro.js": "^4.2.2",
"intro.js-react": "^0.5.0",
"luxon": "^2.0.1",
"overlayscrollbars": "^1.13.1",
"overlayscrollbars-react": "^0.2.3",
"pixabay-api": "^1.0.4",
"plyr-react": "^3.0.8",
"quill": "^1.3.7",
"rc-slider": "^9.7.2",
"react": "^16.13.0",
"react-autosuggest": "^10.1.0",
"react-bootstrap": "^2.0.0-rc.0",
"react-circular-progressbar": "^2.0.4",
"react-contexify": "^5.0.0",
"react-countdown": "^2.3.2",
"react-datepicker": "^4.1.1",
"react-datetime": "^3.1.1",
"react-dom": "^16.13.0",
"react-dropzone-uploader": "^2.11.0",
"react-flow-renderer": "^9.6.2",
"react-fuzzy-highlighter": "^1.0.0",
"react-helmet": "^6.1.0",
"react-hook-mousetrap": "^2.0.4",
"react-image-lightbox": "^5.1.4",
"react-intl": "^5.20.2",
"react-masonry-css": "^1.0.16",
"react-number-format": "^4.6.4",
"react-paginate": "^8.1.3",
"react-rating": "^2.0.5",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.3",
"react-select": "^4.3.1",
"react-simple-maps": "^3.0.0",
"react-slick": "^0.29.0",
"react-sortablejs": "^6.0.0",
"react-syntax-highlighter": "^15.4.4",
"react-table": "^7.7.0",
"react-tag-autocomplete": "^6.2.0",
"react-tenor": "^2.2.0",
"react-toastify": "^7.0.4",
"react-tooltip": "^4.2.21",
"react-world-flags": "^1.5.0",
"redux-undo": "^1.0.1",
"reduxjs-toolkit-persist": "^7.0.1",
"slick-carousel": "^1.8.1",
"sortablejs": "^1.14.0",
"web-vitals": "^0.2.4",
"yup": "^0.32.9"
},
"scripts": {
"start-js": "react-scripts start --dev",
"start-css": "sass --style=compressed --watch
src/sass/styles.scss:public/css/styles.css",
"start": "concurrently \"npm run start-js\" \"npm run start-css\"",
"build-js": "react-scripts build --prod",
"build-css": "sass --style=compressed --no-source-map
src/sass/styles.scss:public/css/styles.css",
"build": "concurrently \"npm run build-css\" \"npm run build-js\"",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint ./src/**/*.js",
"lint:fix": "eslint ./src --fix",
"precommit": "lint-staged",
"concurrently": "concurrently"
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write",
"git add"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#babel/core": "^7.18.2",
"#babel/preset-env": "^7.18.2",
"#babel/preset-react": "^7.17.12",
"babel-loader": "^8.1.0",
"babel-plugin-module-resolver": "^4.1.0",
"concurrently": "^6.2.0",
"eslint": "^7.28.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^6.0.0",
"lint-staged": "^11.0.0",
"prettier": "2.3.1",
"sass": "^1.42.1"
}
}
After I run npm start, it takes about a minute or two until I see Starting the development server and localhost starts loading in browser. And then it takes about 30 minutes until the page is loaded. (Yes 30 minutes!) . I know that the list of dependency is quite long but still I expect it to start in maximum 5 minutes. I have searched a lot for similar issues and tried to apply the suggested solutions:
Allocated more memory: --max_old_space_size=4096
Updated nodejs and npm
Closed all browser tabs before starting the app
Notes:
When I ran npm install there were dependency errors, so I had to do npm install --force
I am running this on Windows 10 , my pc has 8GB of RAM.
Thanks to everyone who will help!

I think the problem is not with the package.json. the problem is you have something that makes it slower, which is the package prettier, the same thing happened to me, the problem was the prettier package that made my app slow by taking too much time in analyzing the format and makes the format better according to the language, so this process takes times, having too much files and prettier checks all of the file again and again, the more files you have the more time it will take. So i recommend removing prettier. You can just download a vscode extension of prettier that does the job better.

Related

react build failed, The 'compilation' argument must be an instance of Compilation

npm start is working fine but when I am trying to build with npm run build, compilation failed with this error
Creating an optimized production build...
Failed to compile.
The 'compilation' argument must be an instance of Compilation
package.json
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"#nivo/radar": "^0.62.0",
"#stripe/react-stripe-js": "^1.7.0",
"#stripe/stripe-js": "^1.22.0",
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"#types/jest": "^24.9.1",
"#types/node": "^12.12.47",
"#types/react": "16.9.23",
"#types/react-bootstrap": "^0.32.28",
"#types/react-dom": "16.9.8",
"#types/react-router-dom": "^5.1.5",
"#types/uuid": "^8.0.0",
"antd": "^4.4.0",
"availity-reactstrap-validation": "^2.7.1",
"awesome-typescript-loader": "^5.2.1",
"axios": "^0.19.2",
"bootstrap": "^5.1.3",
"classnames": "^2.2.6",
"customize-cra": "^1.0.0",
"feather-icons-react": "^0.4.3",
"js-cookie": "^2.2.1",
"less": "^3.11.3",
"less-loader": "^6.2.0",
"lodash": "^4.17.20",
"mini-css-extract-plugin": "^2.4.5",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
"mobx-react-lite": "^2.0.7",
"moment": "^2.27.0",
"react": "16.13.1",
"react-app-rewired": "^2.1.6",
"react-countup": "^4.3.3",
"react-device-detect": "^1.13.1",
"react-dom": "16.13.1",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.0",
"react-svg": "^11.0.29",
"reactstrap": "^9.0.1",
"recharts": "^1.8.5",
"sass": "^1.45.0",
"source-map-loader": "^3.0.0",
"tar": "^6.1.11",
"typescript": "^3.7.5",
"uuid": "^8.2.0"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired 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"
]
},
"devDependencies": {
"#typescript-eslint/eslint-plugin": "^3.5.0",
"#typescript-eslint/parser": "^3.5.0",
"babel-plugin-import": "^1.13.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-react": "^1.1.7",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.0.5"
},
"resolutions": {
"**/react": "16.9.0",
"**/react-dom": "16.9.0"
}
}
I am using Typescript
node version: v16.13.1
npm version: 8.1.2

How do I resolve this dependency conflict from when doing npm link

When I do npm link like this in Window 10:
L:\git\notistack> npm link L:\react\Greta100Weeks\greta100weeks\node_modules\react
In my app when I do import { useSnackbar } from 'notistack'; then I can use the notistack ok, and it's the global notistack. I want to modify it debug it locally so I forked it and did the npm link but when I npm start the the App get the "You might have more than one copy of React in the same app " error. I also test this and it's true so that's why I do the npm link react and it's also recommended so I don't know what I do wrong here
To be able to debug notistack in VSCode and use the notistack in my app in VSCode. I do npm link. I get the Duplicate React error so must npm link the App react version and tell notistack to us the app react.
But I get this error: I do this npm link on other library's without problem but now this error:
I have tried to fixed this but it's not working.
I also do:
L:\git\notistack> npm link L:\react\Greta100Weeks\greta100weeks\node_modules\react-dom
And that is resolving ok.
I fork the notistack library and is using it ok in the app but only when I do npm link it fails. What is the problem here I guess it's in the package.json
Here is the package.json for the forked library notistack:
{
"name": "notistack",
"version": "1.0.10",
"description": "Highly customizable notification snackbars (toasts) that can be stacked on top of each other",
"main": "dist/index.js",
"module": "dist/notistack.esm.js",
"types": "dist/index.d.ts",
"license": "MIT",
"author": {
"name": "Hossein Dehnokhalaji",
"email": "hossein.dehnavi98#yahoo.com",
"url": "https://github.com/iamhosseindhv/notistack"
},
"homepage": "https://www.iamhosseindhv.com/notistack",
"repository": {
"url": "git+https://github.com/iamhosseindhv/notistack.git",
"type": "git"
},
"scripts": {
"build": "tsdx build --transpileOnly --entry ./src/index.js",
"prebuild": "npm run docs",
"prepublishOnly": "npm run build",
"docs": "rimraf typedoc.json && typedoc --tsconfig",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"peerDependencies": {
"#material-ui/core": "^4.11.2",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
},
"devDependencies": {
"#babel/preset-react": "^7.8.3",
"#material-ui/core": "^4.9.5",
"#types/node": "^13.9.0",
"#types/react": "^16.9.23",
"#types/react-dom": "^16.9.5",
"#types/react-is": "^16.7.1",
"#typescript-eslint/eslint-plugin": "^3.9.1",
"#typescript-eslint/parser": "^3.9.1",
"babel-plugin-optimize-clsx": "^2.6.1",
"eslint": "^7.7.0",
"eslint-config-airbnb": "~18.2.0",
"eslint-plugin-import": "~2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.6",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0",
"rimraf": "^3.0.2",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-copy": "^3.3.0",
"tsdx": "^0.13.2",
"typedoc": "^0.16.11",
"typescript": "^3.8.3"
},
"dependencies": {
"clsx": "^1.1.0",
"hoist-non-react-statics": "^3.3.0"
},
"bugs": {
"url": "https://github.com/iamhosseindhv/notistack/issues"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/notistack"
},
"contributors": [
"Hossein Dehnokhalaji (https://www.iamhosseindhv.com/)"
],
"keywords": [
"notistack",
"enqueueSnackbar",
"snackbarprovider",
"useSnackbar",
"multiple",
"react",
"javascript",
"material-ui",
"toast",
"redux",
"snackbar",
"stacked",
"notification",
"material design",
"hossein",
"dehnokhalaji",
"iamhosseindhv"
]
}
Here is the package.json for the app using the library:
{
"name": "greta-thunberg-fff",
"version": "1.2.9",
"private": true,
"homepage": "https://greta.portplays.com",
"main": "index.js",
"module": "dist/index.js",
"files": [
"dist",
"README.md"
],
"dependencies": {
"#material-ui/core": "^4.11.2",
"#material-ui/icons": "^4.11.2",
"#material-ui/lab": "^4.0.0-alpha.57",
"#material-ui/styles": "^4.11.2",
"axios": "^0.19.2",
"bootstrap": "^4.5.2",
"change-case": "^4.1.2",
"classnames": "^2.3.1",
"clean-tag": "^3.1.1",
"clsx": "^1.1.1",
"comma-separated-values": "^3.6.4",
"crypto-js": "^4.0.0",
"date-fns": "^2.23.0",
"faker": "^5.5.3",
"firebase": "^7.23.0",
"formik": "^2.2.5",
"framer-motion": "^2.9.5",
"gsap": "^3.5.1",
"history": "^5.0.0",
"i": "^0.3.6",
"lodash": "^4.17.19",
"lodash.debounce": "^4.0.8",
"mammoth": "^1.4.11",
"material-table": "^1.69.2",
"moment": "^2.27.0",
"normalize-wheel": "^1.0.1",
"notistack": "^1.0.10",
"npm": "^7.11.2",
"pdfjs-dist": "^1.8.357",
"preval.macro": "^5.0.0",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-activity": "^1.2.2",
"react-bootstrap": "^1.3.0",
"react-chartjs-2": "^2.11.1",
"react-data-grid": "^6.1.0",
"react-detect-offline": "^2.4.0",
"react-dom": "^17.0.2",
"react-dropzone": "^11.3.4",
"react-helmet": "^6.1.0",
"react-motion": "^0.5.2",
"react-perfect-scrollbar": "^1.5.8",
"react-redux": "^7.2.5",
"react-resize-detector": "^5.0.7",
"react-router": "^6.0.0-beta.4",
"react-router-dom": "^6.0.0-beta.4",
"react-scripts": "^3.4.0",
"react-slick": "^0.27.3",
"react-spring": "^8.0.27",
"react-transition-group": "^4.4.1",
"react-visibility-sensor": "^5.1.1",
"rebass": "^4.0.7",
"recompose": "^0.30.0",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-saga": "^1.1.3",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"sass": "^1.41.1",
"simplebar-react": "^2.3.5",
"slick-carousel": "^1.8.1",
"styled-components": "^5.1.1",
"styled-system": "^5.1.5",
"three": "^0.85.2",
"typescript": "^3.9.7",
"uuid": "^8.3.1",
"xlsx": "^0.10.1",
"yup": "^0.32.1"
},
"scripts": {
"start": "set PORT=6545&& react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -b master -d build"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"#typescript-eslint/eslint-plugin": "^4.1.1",
"#typescript-eslint/parser": "^4.1.1",
"axios": "^0.19.2",
"babel-eslint": "^10.1.0",
"clean-tag": "^3.1.1",
"eslint": "^6.6.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"gh-pages": "^2.0.1",
"prettier": "^2.1.1",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-scripts": "^3.4.3",
"rebass": "^4.0.7",
"styled-system": "^5.1.5"
}
}

Unable to deploy in ec2 Ubuntu MERN stack

I'm attempting to deploy my MERN stack on an ec2 Ubuntu instance. Everything worked until I installed my project dependencies. My project worked fine in my local but for some reason, I can't fix the dependency issue in the instance (prod):
sudo yarn build
yarn run v1.22.5
$ react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to load plugin 'flowtype' declared in 'package.json ยป eslint-config-react-app': Cannot find module 'eslint/lib/rules/no-unused-expressions'
Require stack:
- /var/www/ubunturadiumlaw/node_modules/eslint-plugin-flowtype/dist/rules/noUnusedExpressions.js
- /var/www/ubunturadiumlaw/node_modules/eslint-plugin-flowtype/dist/index.js
- /var/www/ubunturadiumlaw/node_modules/#eslint/eslintrc/lib/config-array-factory.js
- /var/www/ubunturadiumlaw/node_modules/#eslint/eslintrc/lib/index.js
- /var/www/ubunturadiumlaw/node_modules/react-scripts/node_modules/eslint/lib/cli-engine/cli-engine.js
- /var/www/ubunturadiumlaw/node_modules/react-scripts/node_modules/eslint/lib/cli-engine/index.js
- /var/www/ubunturadiumlaw/node_modules/react-scripts/node_modules/eslint/lib/api.js
- /var/www/ubunturadiumlaw/node_modules/eslint-webpack-plugin/dist/getESLint.js
- /var/www/ubunturadiumlaw/node_modules/eslint-webpack-plugin/dist/linter.js
- /var/www/ubunturadiumlaw/node_modules/eslint-webpack-plugin/dist/index.js
- /var/www/ubunturadiumlaw/node_modules/eslint-webpack-plugin/dist/cjs.js
- /var/www/ubunturadiumlaw/node_modules/react-scripts/config/webpack.config.js
- /var/www/ubunturadiumlaw/node_modules/react-scripts/scripts/build.js
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I tried to install the dependency individually, with npm, with yarn, and apt-get nothing worked.
Here's my package.json file:
"version": "0.1.0",
"private": true,
"dependencies": {
"#fortawesome/fontawesome-free": "^5.15.1",
"#popperjs/core": "^2.5.3",
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"algoliasearch": "^4.5.1",
"algoliasearch-helper": "^3.2.2",
"axios": "^0.19.2",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"bootstrap": "^4.5.3",
"brew": "0.0.8",
"compression": "^1.7.4",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-react": "^7.21.5",
"express": "^4.17.1",
"file-system": "^2.2.2",
"flowtype": "^2.0.0",
"git": "^0.1.5",
"gridfs-stream": "^1.1.1",
"helmet": "^4.1.1",
"https-localhost": "^4.6.3",
"instantsearch.css": "^7.4.5",
"jquery": "^3.5.1",
"method-override": "^3.0.0",
"mongodb": "^3.5.9",
"mongoose": "^5.9.20",
"multer": "^1.4.2",
"multer-gridfs-storage": "^4.2.0",
"node-json-db": "^1.1.0",
"node-sass": "^4.14.1",
"nodemon": "^2.0.4",
"popper.js": "^1.16.1",
"react": "^17.0.1",
"react-autosuggest": "^10.0.2",
"react-bootstrap": "^1.3.0",
"react-create-app": "^2.0.6",
"react-dom": "^17.0.1",
"react-instantsearch-dom": "^6.7.0",
"react-router-dom": "^5.1.2",
"react-scripts": "4.0.0",
"react-tappable": "^1.0.4",
"react-toastify": "^6.0.4",
"rfs": "^9.0.3",
"serve": "^11.3.2",
"typescript": "^4.0.5",
"web-vitals": "^0.2.4",
"yarn": "^1.22.10"
},
"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 wrong?
Ec2 Ubuntu 20.04
Using Node.js as Server
React
Mongo

Nuxt js high CPU usage in dev environment

Since few updates my app front part in docker container doesn't work well
It use above 100% of Docker CPU, 60/70% of my laptop CPU (fans run at 100%)
And the HMR is very slow
This issue doesn't appear on production and on others laptops
I tried many things from different forums similar issues but nothing work
I reseted Docker to factory defaults settings, allowed more memory and CPU
I updated my dependencies
I removed and restored my node modules
I don't know what i should check to fix this issue
MacOS Catalina 10.15.4
Node v13.12.0
My package.json
{
"name": "front",
"version": "1.0.1",
"description": "My first-class Nuxt.js project",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "HOST=0.0.0.0 PORT=8080 nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue .",
"precommit": "npm run lint"
},
"config": {
"nuxt": {
"host": "0.0.0.0",
"port": "8080"
}
},
"dependencies": {
"#fullcalendar/core": "^4.3.1",
"#fullcalendar/daygrid": "^4.3.0",
"#fullcalendar/interaction": "^4.3.0",
"#fullcalendar/timegrid": "^4.3.0",
"#fullcalendar/vue": "^4.3.1",
"#nuxt/webpack": "^2.11.0",
"#nuxtjs/auth": "^4.5.3",
"#nuxtjs/axios": "^5.4.1",
"#nuxtjs/google-analytics": "^2.2.0",
"#nuxtjs/google-tag-manager": "^2.1.4",
"#nuxtjs/gtm": "^2.2.3",
"#nuxtjs/pwa": "^2.6.0",
"#nuxtjs/robots": "^2.0.0",
"#nuxtjs/router": "^1.3.2",
"#nuxtjs/sitemap": "^0.2.2",
"algoliasearch": "^4.1.0",
"cross-env": "^5.2.0",
"cxlt-vue2-toastr": "^1.1.0",
"date-fns": "^1.30.1",
"debug": "^4.1.1",
"gsap": "^2.1.3",
"jquery": "^3.4.1",
"libphonenumber-js": "^1.7.14",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
"nuxt": "^2.11.0",
"nuxt-facebook-pixel-module": "^1.3.0",
"nuxt-google-maps-module": "^1.6.0",
"nuxt-jsonld": "^1.4.5",
"nuxt-token-auth": "^1.0.2",
"nuxt-user-agent": "^1.2.2",
"sass-loader": "^7.1.0",
"vee-validate": "^2.2.0",
"vue": "^2.6.11",
"vue-gallery": "^2.0.0",
"vue-i18n": "^8.10.0",
"vue-infinite-scroll": "^2.0.2",
"vue-instantsearch": "^2.7.0",
"vue-js-modal": "^1.3.33",
"vue-lazyload": "^1.2.6",
"vue-mq": "^1.0.1",
"vue-multiselect": "^2.1.6",
"vue-read-more": "^1.1.1",
"vue-scrollto": "^2.15.0",
"vue-sticky": "^3.3.4",
"vue-tawk": "^1.0.1",
"vue-upload-component": "^2.8.20",
"vue-wait": "^1.3.3",
"vue2-dropzone": "^3.5.8",
"vue2-leaflet": "^1.2.3",
"vuedraggable": "^2.20.0",
"vuejs-datepicker": "^1.5.4",
"vuejs-paginate": "^2.1.0",
"vueperslides": "^2.7.0"
},
"devDependencies": {
"babel-eslint": "^8.2.1",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-loader": "^2.1.2",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^4.7.1",
"nodemon": "^1.18.10"
}
}
Probably problem with the webpack's watch mode.
As stated here:
For some systems, watching many file systems can result in a lot of CPU or memory usage. It is possible to exclude a huge folder like node_modules
module.exports = {
//...
watchOptions: {
ignored: /node_modules/
}
};
In your case (nuxt.js), just add to nuxt.config.js
watchers: {
webpack: {
ignored: /node_modules/
}
}

Error while deploying a node app on Heroku

I used git push heroku command to push my node app to heroku but it shows following errors.
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote: parse error: Expected another key-value pair at line 17,
column 3
remote: ! Unable to parse package.json
remote:
remote:
remote: -----> Build failed
remote: parse error: Expected another key-value pair at line 17,
column 3
remote: parse error: Expected another key-value pair at line 17,
column 3
remote:
remote: We're sorry this build is failing! You can troubleshoot
common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-
node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to guarded-ravine-41633.
remote:
To https://git.heroku.com/guarded-ravine-41633.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/guarded-
ravine-41633.git'
I don't know what i am doing wrong. If anyone could correct me than that would be very appreciated.
This is my package.json file.
{
"name": "project",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "Nikhil <nikhilgupta6532#gmail.com>",
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"unit": "cross-env BABEL_ENV=test karma start
test/unit/karma.conf.js --single-run",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit/specs
test/e2e/specs",
"start":"node server.js",
},
"engines": {
"node": ">= 8.2.1",
"npm": ">= 5.3.0"
},
"dependencies": {
"vue": "^2.3.3",
"vue-router": "^2.6.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"cssnano": "^3.10.0",
"eslint": "^3.19.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^3.0.0",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"webpack-bundle-analyzer": "^2.2.1",
"cross-env": "^5.0.1",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.4.0",
"karma-sinon-chai": "^1.3.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.2",
"lolex": "^1.5.2",
"mocha": "^3.2.0",
"chai": "^3.5.0",
"sinon": "^2.1.0",
"sinon-chai": "^2.8.0",
"inject-loader": "^3.0.0",
"babel-plugin-istanbul": "^4.1.1",
"phantomjs-prebuilt": "^2.1.14",
"chromedriver": "^2.27.2",
"cross-spawn": "^5.0.1",
"nightwatch": "^0.9.12",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0",
"rimraf": "^2.6.0",
"url-loader": "^0.5.8",
"vue-loader": "^12.1.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
I am currently using Vue.js inside my project along with Node.js and sockets.io with database as Mongodb.
Reading though the error you provided, it mentions that it during your build process, it expected another key-value pair on line 17 of package.json.
I ran your package.json through a JSON and found a few issues, as follows -
Parse error on line 11: You should remove the line break between lines 11 and 12.
"unit": "cross-env BABEL_ENV=test karma start test / unit / karma.conf.js--single - run ",
Parse error on line 14:: You should remove the line break between lines 14 and 15.
"lint": "eslint --ext .js,.vue src test/unit/specstest / e2e / specs ",
Parse error on line 15:: You should remove the comma, since this is the last property of scripts.
"start": "node server.js"
Duplicate key 'start' on line 15:: *You need to decide whether you want your start script to be
"start": "node build/dev-server.js", OR "start": "node build/dev-server.js",
Fixing these should solve your build errors.
Corrected package.js file
{
"name": "project",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "Nikhil <nikhilgupta6532#gmail.com>",
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"build": "node build/build.js",
"unit": "cross-env BABEL_ENV=test karma start test / unit / karma.conf.js--single - run ",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit/specs test / e2e / specs ",
"start": "node server.js"
},
"engines": {
"node": ">= 8.2.1",
"npm": ">= 5.3.0"
},
"dependencies": {
"vue": "^2.3.3",
"vue-router": "^2.6.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"cssnano": "^3.10.0",
"eslint": "^3.19.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^3.0.0",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"webpack-bundle-analyzer": "^2.2.1",
"cross-env": "^5.0.1",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.4.0",
"karma-sinon-chai": "^1.3.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.2",
"lolex": "^1.5.2",
"mocha": "^3.2.0",
"chai": "^3.5.0",
"sinon": "^2.1.0",
"sinon-chai": "^2.8.0",
"inject-loader": "^3.0.0",
"babel-plugin-istanbul": "^4.1.1",
"phantomjs-prebuilt": "^2.1.14",
"chromedriver": "^2.27.2",
"cross-spawn": "^5.0.1",
"nightwatch": "^0.9.12",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0",
"rimraf": "^2.6.0",
"url-loader": "^0.5.8",
"vue-loader": "^12.1.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
Check this out you have error . Json error syntax
errors
"unit": all test in same line
same for "lint"
and remove two start and also removed comma in line 17
new file
{
"name": "project",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "Nikhil <nikhilgupta6532#gmail.com>",
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"build": "node build/build.js",
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
"start":"node server.js"
},
"engines": {
"node": ">= 8.2.1",
"npm": ">= 5.3.0"
},
"dependencies": {
"vue": "^2.3.3",
"vue-router": "^2.6.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"cssnano": "^3.10.0",
"eslint": "^3.19.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^3.0.0",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"webpack-bundle-analyzer": "^2.2.1",
"cross-env": "^5.0.1",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.4.0",
"karma-sinon-chai": "^1.3.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.2",
"lolex": "^1.5.2",
"mocha": "^3.2.0",
"chai": "^3.5.0",
"sinon": "^2.1.0",
"sinon-chai": "^2.8.0",
"inject-loader": "^3.0.0",
"babel-plugin-istanbul": "^4.1.1",
"phantomjs-prebuilt": "^2.1.14",
"chromedriver": "^2.27.2",
"cross-spawn": "^5.0.1",
"nightwatch": "^0.9.12",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0",
"rimraf": "^2.6.0",
"url-loader": "^0.5.8",
"vue-loader": "^12.1.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

Resources