I'm working on a react app, deployed and maintained through azure
devops. When I run prettier locally by command npm run
format:check then all files are formatted with message as All
matched files use Prettier code style!. But in azure pipeline I added
npm installer, with Command and arguments as run format:check , but it shows that Code style issues found in n files. Forgot to run Prettier?
package.json
"scripts": {
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"devDependencies": {
"eslint": "^8.23.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.1",
"jest-editor-support": "^30.1.0",
"lint-staged": "^13.0.3",
"playwright": "^1.25.2",
"prettier": "^2.7.1",
"sass": "^1.54.4"
}
Which files does it say still need to be formatted? I'm guessing that these will be files which are generated at some point during the pipeline (e.g. node_modules, or build artifacts).
If so, the solution would be adding those files to the .prettierignore file
Related
So, the problem is that my Vue app was working just fine last night, i turned of the server and went to sleep, nothing was changed or updated and i woke up this morning wanted to continue what i was doing and go for the yarn serve to open it up, and i got the error : "'vue-cli-service' is not recognized as an internal or external command, operable program or batch file.". Anyone encountered something similar?
Thanks for answering!
The package.json:
{
"name": "rails-front",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#fortawesome/fontawesome-free": "^6.2.1",
"axios": "^1.2.5",
"bootstrap": "^5.2.3",
"bootstrap-vue": "^2.23.1",
"core-js": "^3.8.3",
"vue": "^3.2.45",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
},
"devDependencies": {
"#babel/core": "^7.12.16",
"#babel/eslint-parser": "^7.12.16",
"#vue/cli-plugin-babel": "~5.0.0",
"#vue/cli-plugin-eslint": "~5.0.0",
"#vue/cli-plugin-router": "~5.0.0",
"#vue/cli-plugin-vuex": "~5.0.0",
"#vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.0.3",
"prettier": "^2.4.1"
}
}
So instinctively i tried reinstaling the vue cli, and i done that and again it gives me the same error, so im locked in place rn
Follow the instructions step by step:
Open cmd and run the command npm uninstall -g #vue/cli
then npm install -g #vue/cli
Open your project and remove node_modules.
Re-install the packages.
This must fix your problem.
I m trying to setup eslint, prettier, husky for pre commit. But as of now just wanted to run lint and prettier in terminal. But while running lint and format I m getting below error.
//package.json
"scripts": {
.
.
.
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"format": "prettier --write ."
},
"devDependencies": {
"eslint": "^8.23.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.1",
"jest-editor-support": "^30.1.0",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"sass": "^1.54.4"
}
//terminal> npm run lint
> eslint .
Oops! Something went wrong! :(
ESLint: 8.21.0
ESLint couldn't find the config "airbnb" to extend from. Please check that the name of the config is correct.
The config "airbnb" was referenced from the config file
//terminal> npm run format
> prettier --write .
'prettier' is not recognized as an internal or external command,
operable program or batch file.
I want to Generate an APK, I follow these steps In Docs but still have A Build Failed
1. cd android
2. gradlew clean "build Successful"
3. gradlew assembleRelease "BUILD FAILED" with this
Could not read path '\node_modules#babel\parser.bin\parser'.
Here is package.json File
Package.Json
{
"name": "DemoApp",
"version": "1.12.3",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"#turf/distance": "^6.0.1",
"#turf/helpers": "^6.1.4",
"#turf/invariant": "^6.1.2",
"#turf/turf": "^5.1.6",
"lodash": "^4.17.11",
"react": "16.8.6",
"react-native": "0.59.8",
"react-native-datepicker": "^1.7.2",
"react-native-fcm": "^16.2.4",
"react-native-firebase": "5.3.1",
"react-native-gesture-handler": "1.2.1",
"react-native-image-picker": "^0.28.0",
"react-native-linear-gradient": "^2.5.4",
"react-native-maps": "^0.24.2",
"react-native-svg": "^9.3.3",
"react-native-vector-icons": "^6.4.2",
"react-navigation": "3.11.0"
},
"devDependencies": {
"#babel/parser": "^7.4.4",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.8.0",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.54.1",
"react-devtools": "^3.6.1",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
I also faced the same problem and solved by downgrading yarn version to 1.10.1, then it works. May it work for you as well.
Uninstall yarn 1.12.3
Install yarn 1.10.1
Go to project folder and execute yarn install
Build my project and the error is gone
Delete the node_module folder and then run npm install.
I've made a project and pushed it to Github. Now when I clone it to my local server everything works fine. But when I'm on my live server and run npm run build it sometimes works (1 out of 10 times). I'm using Ubuntu 16 with nginx and I'm using simple webpack with vue. I also have the latest node and npm on my server.
I don't get any errors and warnings. After executing the command correctly it usually show that build.js and build map is created but. Most of the times it show nothing it only show that it is busy with optimizing but I'm not getting any results.
What I mean with: "It is sometimes working" is e.g when I run 8 times in a row npm run build WITHOUT changing any code it is finally working.
I'm very new to the JavaScript tools and what I understand is npm run build is to build my project and create a build.js file for my live server while npm run dev is for localhost.
Does anyone know what is the problem?
This is my package.json
{
"name": "front",
"description": "A Vue.js project",
"version": "1.0.0",
"author": "My name",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"vue": "^2.3.3",
"vue-authenticate": "^1.2.7",
"vue-echo": "^1.0.1",
"vue-resource": "^1.3.4",
"vue-router": "^2.7.0"
},
"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-env": "^1.5.1",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"node-sass": "^4.5.0",
"sass-loader": "^5.0.1",
"vue-loader": "^12.1.0",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5"
}
}
I don't know if this is relevant but this is my nginx block configuration:
server {
listen 80;
listen [::]:80;
root /var/www/my_project/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name my_project.com www.my_project.com
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
I just reinstalled my VPS and its working now. I don't know what was wrong, maybe node was installed wrong but i don't know if that even possible.. anyway its working now!
I'm getting the following NPM error when I deploy to Heroku. My project is a mern stack.
Error: Couldn't find preset "es2015" relative to directory "/app"
Packages seem to be installed correctly, I have a .babelrc file set up correctly, and nothing is different locally compared to remote other than the parent directories are different. On Heroku, the parent directory is obviously "app". These are my NPM packages:
"dependencies": {
"babel-core": "^6.7.2",
"babel-polyfill": "^6.7.4",
"body-parser": "~1.12.0",
"cookie-parser": "~1.3.4",
"css-modules-require-hook": "^4.0.0",
"debug": "~2.1.1",
"express": "~4.12.2",
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-redux": "^4.4.1",
"react-router": "^2.0.1",
"redux": "^3.3.1",
"serve-favicon": "~2.2.0",
"webpack": "^1.12.13"
},
"devDependencies": {
"babel-eslint": "^5.0.0",
"babel-loader": "^6.2.4",
"babel-plugin-react-transform": "^2.0.2",
"babel-polyfill": "^6.7.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-react-hmre": "^1.1.1",
"babel-register": "^6.7.2",
"css-modules-require-hook": "^4.0.0",
"redux-devtools": "^3.1.1",
"redux-devtools-dock-monitor": "^1.1.0",
"redux-devtools-log-monitor": "^1.0.4",
"webpack-dev-middleware": "^1.5.1",
"webpack-hot-middleware": "^2.10.0"
}
Furthermore, npm start runs index.js which consists of the following:
require('babel-core/register');
require('babel-polyfill');
require('css-modules-require-hook');
require('./server/index');
I actually was getting errors with babel-polyfill and css-modules-require-hook not being found or something (I can't remember unfortunately) but when I added them from my devDependencies to my dependencies, it seemed to resolve itself. It's rather difficult to determine what packages to put where actually (any tips?). I'd really appreciate some direction!
From what i understand, heroku defaults to adding the --production flag, which inturn doesnt install your devdependencies. I'd move all necessary dependencies to create your build to devDep to dependencies.
or
heroku config:set NPM_CONFIG_PRODUCTION=false