Unable to install Flow for React in Laravel project - reactjs

I am developing a Laravel application. For the front end, I am using React JS. Now I am trying to integrate Flow into my project. I followed this link https://flow.org/en/docs/install/. But not working.
I run this command in the root folder
npm install --save-dev babel-cli babel-preset-flow
Then created .babelrc file in the project root folder with the following content
{
"presets": ["flow"]
}
Then I run this command
npm install --save-dev flow-bin
This is my package.json
{
"private": true,
"scripts": {
"flow": "flow",
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"#babel/preset-react": "^7.0.0",
"axios": "^0.18.0",
"babel-cli": "^6.26.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-react": "^6.23.0",
"bootstrap": "^4.2.1",
"cross-env": "^5.1",
"flow-bin": "^0.89.0",
"jquery": "^3.2",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"react": "^16.2.0",
"react-dom": "^16.7.0",
"react-scripts": "^2.1.2",
"resolve-url-loader": "^2.3.1",
"sass": "^1.15.2",
"sass-loader": "^7.1.0"
},
"dependencies": {
"#coreui/coreui": "github:coreui/coreui",
"#coreui/coreui-plugin-chartjs-custom-tooltips": "github:coreui/coreui-plugin-chartjs-custom-tooltips",
"#coreui/react": "^2.1.2",
"classnames": "^2.2.6",
"core-js": "^2.6.1",
"enzyme": "^3.8.0",
"flag-icon-css": "^3.2.1",
"font-awesome": "^4.7.0",
"node-sass": "^4.11.0",
"prop-types": "^15.6.2",
"react-app-polyfill": "^0.1.3",
"react-loadable": "^5.5.0",
"react-redux": "^6.0.0",
"react-router": "^4.3.1",
"react-router-config": "^4.4.0-beta.6",
"react-router-dom": "^4.3.1",
"react-test-renderer": "^16.7.0",
"reactstrap": "^6.5.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"simple-line-icons": "^2.4.1"
}
}
Then I run this
npm run flow init
Then this
npm run flow
I got this error when I run the above command.
> # flow /Users/wai/Desktop/easy-eat
> flow
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ vendor/symfony/translation/Tests/fixtures/empty.json:1:1
Unexpected end of input
1│
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ vendor/symfony/translation/Tests/fixtures/malformed.json:2:11
Unexpected string
1│ {
2│ "foo" "bar"
3│ }
Found 2 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # flow: `flow`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # flow 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/wai/.npm/_logs/2018-12-28T21_01_36_563Z-debug.log
What is missing and how can I fix it?

I ran into this as well. By default Flow will check all the directories in your project. You can fix this error by creating a .flowconfig file in the root of your project. (Running yarn run flow init will also create this file for you)
Make sure to ignore the vendor folder through this config. My config looks like this:
[ignore]
.*/vendor/.*
[include]
[libs]
[lints]
[options]
[strict]

Related

How to fix Could not resolve dependency: npm ERR

Hi on npm install i got this error:
how can i solve it without using --force or --legacy-peer-deps?
i tried to looking for similar problems but all the suggestion is to using the above flags.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #babel/eslint-parser#7.18.2
npm ERR! Found: eslint#5.16.0
npm ERR! node_modules/eslint
npm ERR! dev eslint#"^5.16.0" from the root project
npm ERR! peer eslint#"*" from #typescript-eslint/experimental-utils#2.34.0
npm ERR! node_modules/#typescript-eslint/experimental-utils
npm ERR! #typescript-eslint/experimental-utils#"^2.5.0" from eslint-plugin-jest#23.20.0
npm ERR! node_modules/eslint-plugin-jest
npm ERR! dev eslint-plugin-jest#"^23.7.0" from the root
project
npm ERR! 8 more (babel-eslint, eslint-config-prettier, eslint-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint#"^7.5.0 || ^8.0.0" from #babel/eslint-parser#7.18.2
npm ERR! node_modules/#babel/eslint-parser
npm ERR! #babel/eslint-parser#"^7.16.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint#8.19.0
npm ERR! node_modules/eslint
npm ERR! peer eslint#"^7.5.0 || ^8.0.0" from #babel/eslint-parser#7.18.2
npm ERR! node_modules/#babel/eslint-parser
npm ERR! #babel/eslint-parser#"^7.16.5" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
this is my package.json file:
{
"name": "ng_starter",
"version": "0.0.1",
"description": "ng_starter",
"private": true,
"scripts": {
"dev": "webpack-cli serve --mode development --env=development --hot",
"mock": "webpack-cli serve --mode development --env=mock --hot",
"prod": "webpack-cli build --mode production --env=production",
"devprod": "webpack-cli build --mode development --env=devprod",
"test": "jest --env=jsdom",
"test-dev": "jest --env=jsdom --watch",
"lint-fix": "eslint --fix --ext .js --ext .jsx src"
},
"dependencies": {
"#babel/eslint-parser": "^7.16.5",
"#reduxjs/toolkit": "^1.7.1",
"axios": "^0.21.1",
"catalogone-ui-components": "1.16.0",
"catalogone-ui-utility": "1.16.0",
"classnames": "2.2.6",
"d3-hierarchy": "^3.1.1",
"i18next": "17.0.3",
"connected-react-router": "^6.9.1",
"lodash": "^4.17.21",
"prop-types": "15.7.2",
"query-string": "^6.10.1",
"react": "16.8.6",
"react-dom": "16.8.6",
"react-redux": "^7.2.6",
"react-redux-i18n": "^1.9.2",
"react-test-renderer": "16.8.6",
"redux-actions": "^2.6.5",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"validator": "^12.2.0"
},
"devDependencies": {
"#babel/cli": "7.12.10",
"#babel/core": "7.12.10",
"#babel/plugin-proposal-class-properties": "7.12.1",
"#babel/plugin-proposal-decorators": "7.12.12",
"#babel/plugin-proposal-export-default-from": "7.12.1",
"#babel/plugin-proposal-function-bind": "7.12.1",
"#babel/plugin-proposal-nullish-coalescing-operator": "7.12.1",
"#babel/plugin-proposal-optional-chaining": "7.12.7",
"#babel/plugin-transform-runtime": "^7.12.10",
"#babel/preset-env": "7.12.11",
"#babel/preset-react": "^7.16.7",
"#babel/register": "7.12.10",
"#babel/runtime": "^7.12.5",
"babel-eslint": "^10.1.0",
"babel-loader": "8.0.6",
"babel-plugin-istanbul": "5.2.0",
"babel-plugin-module-resolver": "3.2.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.4.1",
"css-loader": "2.1.1",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.1.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.7.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "4.2.0",
"eslint-webpack-plugin": "^3.1.0",
"file-loader": "^4.0.0",
"html-webpack-plugin": "^4.5.2",
"jest": "^25.1.0",
"mini-css-extract-plugin": "^1.6.2",
"mocker-api": "^2.9.4",
"node-sass": "npm:sass#1.32.8",
"prettier": "1.19.1",
"react-router-dom": "^5.3.0",
"sass-loader": "7.1.0",
"sass-resources-loader": "2.0.1",
"source-map-loader": "^1.1.3",
"style-loader": "0.23.1",
"svg-transform-loader": "^2.0.13",
"url-loader": "2.0.0",
"webpack": "^4.44.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^3.10.3",
"webpack-merge": "^5.7.3"
}
}
It seems to me like I have babel/eslint-parser#7.18.2
but I'm not totally sure how to solve this

CRA project node v14.17.0 - Loading PostCSS "postcss-preset-env" plugin failed: Cannot find module 'node:vm'

I'm getting the following error when trying to start a CRA project running with node 14.17.0 -> Loading PostCSS "postcss-preset-env" plugin failed: Cannot find module 'node:vm'
Compiled with problems:X
ERROR in ./src/app.css (./node_modules/css-loader/dist/cjs.js??ruleSet1.rules[0].oneOf[5].use1!./node_modules/postcss-loader/dist/cjs.js??ruleSet1.rules[0].oneOf[5].use[2]!./src/app.css)
Module Error (from ./node_modules/postcss-loader/dist/cjs.js):
Loading PostCSS "postcss-preset-env" plugin failed: Cannot find module 'node:vm'
Require stack:
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/#csstools/postcss-trigonometric-functions/dist/index.cjs
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/postcss-preset-env/dist/index.cjs
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/postcss-loader/dist/utils.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/postcss-loader/dist/index.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/postcss-loader/dist/cjs.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/loader-runner/lib/loadLoader.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/loader-runner/lib/LoaderRunner.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/webpack/lib/NormalModule.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/webpack-manifest-plugin/dist/index.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/react-scripts/config/webpack.config.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/react-app-rewired/overrides/webpack.js
/Users/niltonxd/Workspace/harv-Harvest-frontend/node_modules/react-app-rewired/scripts/start.js
(#/Users/niltonxd/Workspace/harv-Harvest-frontend/src/app.css)
{
"name": "harvest-front",
"version": "1.7.4",
"private": true,
"dependencies": {
"#ant-design/icons": "^4.7.0",
"#fortawesome/fontawesome-svg-core": "^1.2.22",
"#fortawesome/free-solid-svg-icons": "^5.10.2",
"#fortawesome/react-fontawesome": "^0.1.4",
"#types/jest": "^27.4.1",
"#types/node": "^17.0.23",
"#types/react": "^17.0.43",
"#types/react-dom": "^17.0.14",
"antd": "^4.18.7",
"apexcharts": "^3.19.2",
"apisauce": "^1.1.0",
"connected-react-router": "^6.5.2",
"dotenv": "^10.0.0",
"formik": "^2.2.9",
"har-validator": "^5.1.5",
"history": "4.10.1",
"js-file-download": "^0.4.9",
"leaflet": "^1.7.1",
"lodash": "^4.17.21",
"moment": "^2.22.2",
"moment-timezone": "^0.5.33",
"papaparse": "^5.2.0",
"password-validator": "^5.0.2",
"prop-types": "^15.6.2",
"query-string": "^6.8.3",
"react": "^17.0.2",
"react-apexcharts": "^1.3.7",
"react-clear-cache": "^1.2.0",
"react-custom-scrollbars": "^4.2.1",
"react-dom": "npm:#hot-loader/react-dom#^17.0.2",
"react-error-boundary": "^3.1.4",
"react-intl": "^2.4.0",
"react-leaflet": "2.8.0",
"react-number-format": "^4.3.1",
"react-redux": "^7.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "5.0.1",
"recharts": "^1.0.1",
"redis": "^3.1.2",
"redux": "^4.0.1",
"redux-persist": "^6.0.0",
"redux-saga": "^1.0.2",
"source-map-explorer": "^2.5.2",
"typescript": "^4.6.3",
"url-search-params": "^1.1.0",
"xlsx": "^0.16.4",
"yup": "^0.27.0"
},
"resolutions": {
"moment": "2.24.0",
"antd": "4.2.4",
"immer": "9.0.6",
"property-expr": "2.0.3",
"ansi-html": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz",
"glob-parent": "6.0.1",
"styled-components": "^5"
},
"scripts": {
"prebuild": "npm install react-dom#17.0.2 --save",
"sonar": "node sonar-project.js",
"start": "react-app-rewired start",
"start::dev": "env-cmd -e dev react-app-rewired start",
"start::qa": "env-cmd -e qa react-app-rewired start",
"start::np": "env-cmd -e np react-app-rewired start",
"build": "react-app-rewired --max-old-space-size=8192 build",
"test": "react-app-rewired test",
"test::ci": "react-app-rewired test --coverage=false --ci --watchAll=false --collectCoverageFrom=src/**/*.js --collectCoverageFrom=!src/assets/**/*.js",
"qa": "PORT=8081 react-scripts start",
"cy::op": "cypress open",
"cy::ru": "cypress run",
"lint": "eslint --max-warnings 0 --ignore-path .gitignore --fix --ext .js,.jsx,.ts,.tsx src",
"prettier": "prettier --ignore-path .gitignore \"**/*.+(js|json)\"",
"format": "yarn run prettier -- --write",
"check-format": "yarn run prettier -- --list-different",
"validate": "yarn run lint && yarn run test --watchAll --bail",
"createJob": "node ci/createJob.js",
"deleteJob": "node ci/deleteJob.js",
"checkEnvironment": "node ci/checkEnvironment.js",
"cm": "cz",
"analyze": "source-map-explorer 'build/static/js/*.js'",
"generate:gc": "plop --plopfile ./generators/globalComponent.js"
},
"devDependencies": {
"#babel/plugin-proposal-class-properties": "^7.16.0",
"#babel/plugin-proposal-private-methods": "^7.14.5",
"#babel/plugin-proposal-private-property-in-object": "^7.15.4",
"#babel/preset-typescript": "^7.16.7",
"#commitlint/cli": "^16.0.2",
"#commitlint/config-conventional": "^16.0.0",
"#testing-library/cypress": "^8.0.1",
"#testing-library/dom": "^8.5.0",
"#testing-library/jest-dom": "^5.14.1",
"#testing-library/react": "^12.1.0",
"#testing-library/react-hooks": "^7.0.2",
"#testing-library/user-event": "^13.3.0",
"#types/lodash": "^4.14.182",
"#types/react-router-dom": "^5.3.3",
"#types/styled-components": "^5.1.24",
"#types/yup": "^0.29.13",
"#typescript-eslint/eslint-plugin": "^5.18.0",
"#typescript-eslint/parser": "^5.18.0",
"babel-eslint": "^10.1.0",
"babel-plugin-styled-components": "^2.0.6",
"commitizen": "^4.2.4",
"customize-cra": "^1.0.0",
"customize-cra-less-loader": "^2.0.0",
"cypress": "9.5.2",
"cypress-file-upload": "^5.0.8",
"cypress-mochawesome-reporter": "^2.3.0",
"cz-conventional-changelog": "^3.3.0",
"env-cmd": "^10.1.0",
"eslint": "^7.11.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-jest-dom": "^3.9.2",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.29.3",
"eslint-plugin-sonarjs": "^0.6.0",
"eslint-plugin-testing-library": "^4.12.2",
"husky": "^4.2.3",
"jest-axe": "^5.0.1",
"jest-styled-components": "^7.0.8",
"less": "^4.1.2",
"less-loader": "^10.2.0",
"less-vars-to-js": "^1.3.0",
"lint-staged": "^11.1.2",
"plop": "^3.0.5",
"postcss-normalize": "^10.0.1",
"prettier": "^2.3.0",
"react-app-rewired": "^2.1.8",
"react-extras": "^3.0.0",
"react-ga": "^3.3.0",
"react-hot-loader": "^4.13.0",
"reactotron-apisauce": "^3.0.0",
"reactotron-react-js": "^3.3.2",
"reactotron-redux": "^3.1.1",
"reactotron-redux-saga": "^4.2.2",
"resolve-url-loader": "^3.1.2",
"sonarqube-scanner": "^2.8.0",
"styled-components": "^5.3.5"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"jest": {
"moduleDirectories": [
"node_modules",
"src"
],
"moduleNameMapper": {
"#components/(.*)": "<rootDir>/./src/components/$1",
"#util/(.*)": "<rootDir>/./src/util/$1",
"#hooks/(.*)": "<rootDir>/./src/hooks/$1",
"#constants/(.*)": "<rootDir>/./src/constants/$1",
"#containers/(.*)": "<rootDir>/./src/containers/$1",
"#routes/(.*)": "<rootDir>/./src/routes/$1",
"#appRedux/(.*)": "<rootDir>/./src/appRedux/$1"
}
}
}
As it appears this error will temporarily get fixed by installing the latest version of Node.js.
So to fix this follow these steps:
Download and install the latest Node.js version (recommended for most users, which is 16.15.0 at this moment).
Delete your node_modules directory from your project. Then you can optionally clear npm cache with npm cache clean and verify it with npm cache verify.
Delete package-lock.json/yarn.lock file.
Reinstall all of the dependencies and create a new dependency tree using one of the following commands: npm i/npm install/yarn/yarn install.
Note1: If in any case, you use node-sass in React projects yet, it is recommended to use sass instead.
Note2: In some cases skipping step 1 will also work as expected, but I recommend upgrading the Node.js version if you do not have other dependencies to prevent that.
Note3: As #IvaniltonBezerra mentions in the comments, some app builds may throw errors, since upgrading Node.js to its latest version will upgrade the npm as well it may not compatible with your current dependency tree in production, so to prevent such a problem you have to use --legacy-peer-deps to restore the old behaviour of the old dependencies.
Update
This is now seem to be permanently solved in PostCSS Preset Env and following the above steps with skipping step 1 will also solve the problem.
You're most likely trying to use create-react-app inside of an image, and the image's current Node version/configurations are crossing wires with create-react-app; that's what I just did by mistake using Docker, and I got the same exact compiling error with node:vm as a missing module
If you're using create-react-app, don't use it while you're in any Docker/Dev Environment images, just run the npx command in your terminal as is (probably helps having node downloaded on your local machine as well)
npx create-react-app my-app --template typescript
Hopefully that helps, I know that solved my problem
I had the same issue. I am using macOS, so some of the commands below are not applicable if we are using Windows or Linux.
I did the following steps to fix the issue:
Remove node_modules and clear the npm cache
rm -f -r node_modules && npm cache verify
Install the current latest node version (16.15.0)
// if you are using nvm to manage the node versioning
nvm install 16.15.0
nvm use 16.15.0
We can access here if we are using N, homebrew or MacPorts
Reinstall the project packages
npm i

eslint not working in my react and webpack app - npm run lint:fix issue

I am trying to run npm run lint:fix in my react/webpack app.
The command runs and I get ✖ 828 problems (828 errors, 0 warnings)
but then it doesnt fix any of the errors and I get an error message. Im not sure what the error message means, do I need some sort of plugin for eslint to work in webpack? I dont know webpack that well.
✖ 828 problems (828 errors, 0 warnings)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-with-webpack#1.0.0 lint:fix: `eslint --fix .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-with-webpack#1.0.0 lint:fix script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
package.json
{
"name": "react-with-webpack",
"version": "1.0.0",
"description": "",
"proxy": "http://127.0.0.1:4000",
"main": "index.js",
"scripts": {
"dev": "webpack-dev-server --mode development --open --hot",
"build": "webpack --mode production",
"start": "node serve.js",
"lint": "eslint .",
"lint:fix": "eslint --fix ."
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/core": "^7.11.6",
"#babel/plugin-transform-runtime": "^7.12.10",
"#babel/polyfill": "^7.11.5",
"#babel/preset-env": "^7.11.5",
"#babel/preset-react": "^7.10.4",
"babel-loader": "^8.1.0",
"babel-plugin-transform-runtime": "^6.23.0",
"copy-webpack-plugin": "^8.0.0",
"css-loader": "^5.0.1",
"dotenv-webpack": "^7.0.2",
"eslint": "^7.21.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^4.5.1",
"http-proxy-middleware": "^1.0.6",
"style-loader": "^2.0.0",
"url-loader": "^4.1.1",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"#babel/runtime": "^7.12.5",
"axios": "^0.21.0",
"babel-plugin-styled-components": "^1.12.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"formik": "^2.2.6",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-datepicker": "^3.3.0",
"react-dom": "^16.13.1",
"react-icons": "^4.1.0",
"react-loader-spinner": "^3.1.14",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"styled-components": "^5.2.1",
"yup": "^0.32.8"
}
}

How to install ng on elastic beanstalk

I am new to elastic beanstalk, I am trying to deploy my angular-cli app on node.js elastic beanstalk. I am getting following error.
/var/log/nodejs/nodejs.log
-------------------------------------
npm ERR! Failed at the mypleaks-angular#0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
> mypleaks-angular#0.0.0 start /var/app/current
> ng serve
sh: ng: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! mypleaks-angular#0.0.0 start: `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the mypleaks-angular#0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
> mypleaks-angular#0.0.0 start /var/app/current
> ng serve
To resolve this I have used .ebextensions/nodecommand.config as below
option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm install"
But issue still not got resolved. my Directory structure is as below:-
mypleaks-angular/
.ebextensions/nodecommand.config
package.json
and package.json is as below:-
{
"name": "mypleaks-angular",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.0.0",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.1",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/router": "^5.0.0",
"auth0-js": "^8.11.2",
"core-js": "^2.4.1",
"ng-cli": "^0.7.0",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "1.5.0",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^5.0.0",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}
Please help me resolve this issue.
Remove this ebextensions:
option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm install"
Add:
"#angular/cli": "latest",
under dependencies in package.json
Then zip the folder content, and upload the zip file to Elastic Beanstalk

React 0.14 error: Module build failed: ReferenceError: [BABEL] .../node_modules/eslint-loader/index.js!/.../main.jsx: Unknown option: base.stage

This is my package.json:
"scripts": {
"test": "echo \"Error: no test specified\n\" && exit 1",
"lint": "npm run lint-js && npm run lint-css",
"lint-js": "echo \"\\033[33mLinting JS\\033[0m\n\" && eslint . --ext .js --ext .jsx",
"lint-css": "echo \"\\033[33mLinting CSS\\033[0m\n\" && csslint app/style --quiet",
"start": "echo \"\\033[33mStarting dev server at localhost:8080\\033[0m\n\" && TARGET=dev webpack-dev-server --devtool eval-source --progress --colors --hot --inline --history-api-fallback",
"compile": "echo \"\\033[33mBuilding for production\\033[0m\n\" && TARGET=build webpack -p",
"build": "npm run lint-js && npm run lint-css && npm run compile"
},
"private": true,
"dependencies": {
"alt": "^0.17.8",
"babel-core": "^6.1.2",
"babel-loader": "^6.1.0",
"babelify": "^7.2.0",
"css-loader": "^0.22.0",
"csslint": "^0.10.0",
"csslint-loader": "^0.2.1",
"eslint": "^1.9.0",
"eslint-plugin-react": "^3.8.0",
"file-loader": "^0.8.4",
"flowcheck": "^0.2.7",
"flowcheck-loader": "^1.0.0",
"gsap": "^1.18.0",
"html-webpack-plugin": "^1.6.2",
"jquery-browserify": "^1.8.1",
"node-libs-browser": "^0.5.3",
"radium": "^0.14.3",
"react": "^0.14.2",
"react-bootstrap": "^0.27.3",
"react-bootstrap-modal": "^2.0.0",
"react-dom": "^0.14.2",
"react-hot-loader": "^1.3.0",
"react-odometer": "0.0.1",
"react-slick": "^0.9.1",
"react-swf": "^0.13.0",
"style-loader": "^0.13.0",
"superagent": "^1.4.0",
"url-loader": "^0.5.6",
"video.js": "^5.0.2",
"webpack": "^1.12.3",
"webpack-dev-server": "^1.12.1",
"webpack-merge": "^0.2.0"
}
}
This is the complete error message, I read that this error can be solved using babelify so I added it, although I don't need it.
ERROR in ./app/
main.jsx
Module build failed: ReferenceError: [BABEL] /Dev/Fanatico/node_modules/eslint-loader/index.js!/Dev/Fanatico/app/main.jsx: Unknown option: base.stage
at Logger.error (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/logger.js:43:11)
at OptionManager.mergeOptions (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/options/option-manager.js:245:18)
at OptionManager.init (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/options/option-manager.js:396:10)
at File.initOptions (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/index.js:191:75)
at new File (/Dev/Fanatico/node_modules/babel-core/lib/transformation/file/index.js:122:22)
at Pipeline.transform (/Dev/Fanatico/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
at transpile (/Dev/Fanatico/node_modules/babel-loader/index.js:14:22)
at Object.module.exports (/Dev/Fanatico/node_modules/babel-loader/index.js:83:14)
# multi main
It all started when I wanted to upgrade to React 0.14, and ended up installing all the packages one by one.
You will need to have installed:
babel-core
babel-loader
babel-preset-es2015
babel-preset-react
babel-preset-stage-0
Your dependencies in your package.json would be:
{
"name": "react-transform-example",
"devDependencies": {
"babel-core": "^6.0.20",
"babel-loader": "^6.0.1",
"babel-preset-es2015": "^6.0.15",
"babel-preset-react": "^6.0.15",
"babel-preset-stage-0": "^6.0.15",
"express": "^4.13.3",
"webpack": "^1.9.6"
},
"dependencies": {
"react": "^0.14.0",
"react-dom": "^0.14.0"
}
}
And your .babelrc file
{
"presets": ["es2015", "stage-0", "react"]
}
More info at setting-up-babel-6
You're using babel 6 which doesn't have a stage option anymore, instead you have to use presets, e.g:
http://babeljs.io/docs/plugins/#presets
http://babeljs.io/docs/plugins/preset-stage-0/
Installation
$ npm install babel-preset-stage-0
Usage
Add the following line to your .babelrc file:
{"presets": ["stage-0"] }
Note you'll also need the es2015 and react preset. Also note that at least some of the hot reloading plugins are not compatible yet.

Resources