Npm install rally coding eslint in atom is not working - react-native

I've installed linter and linter-eslint plugin in atom. But installing eslint rallycoding is giving trouble. What might be the issue, I can not figure it out.
Following is the error message:
E:\zreactNative\test\ReduxTest>npm install --save-dev eslint-config-rallycoding
npm WARN deprecated eslint-plugin-class-property#1.1.0: please use eslint-plugin-babel and babel/semi
npm ERR! Unexpected end of JSON input while parsing near '...2.0","esutils":"^2.0.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\bbeck\AppData\Roaming\npm-cache\_logs\2018-09-25T07_13_26_749Z-debug.log
2018-09-25T07_13_26_749Z-debug.log
package.json:
{
"name": "ReduxTest",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-elements": "^0.19.1",
"react-native-vector-icons": "^5.0.0",
"react-redux": "^5.0.7",
"redux": "^4.0.0"
},
"devDependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "4.0.0",
"eslint-plugin-babel": "^5.2.0",
"jest": "23.5.0",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}

Solved it. It was an issue of npm. npm cache clean --force does the trick.

Related

RN - Could not find a declaration file for module vendor/react-native-vector-icons

I am using expo 34.0.1 for react native development. I am using TypeScript for the project and running tsc --project . --noEmit in a testing script with jest. That leads to the following error:
node_modules/#expo/vector-icons/build/createIconSet.d.ts:2:55 - error
TS7016: Could not find a declaration file for module
'./vendor/react-native-vector-icons/lib/create-icon-set'.
'../node_modules/#expo/vector-icons/build/vendor/react-native-vector-icons/lib/create-icon-set.js'
implicitly has an 'any' type.
2 export { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from
'./vendor/react-native-vector-icons/lib/create-icon-set';
Found 1 error.
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! # tsc-test: tsc
--project . --noEmit npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the # tsc-test 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/.npm/_logs/2019-08-31T19_25_49_598Z-debug.log
tsconfig.json:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "es6",
"target": "es6",
"lib": ["es2016", "esnext.asynciterable"],
"jsx": "react-native",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"types": ["jest"],
"moduleResolution": "node",
"allowJs": false,
"esModuleInterop": true
},
"exclude": ["node_modules"]
}
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"test": "npm run tslint && npm run tsc-test && npm run jest",
"tslint": "tslint --project .",
"tsc-test": "tsc --project . --noEmit",
"jest": "jest"
},
"dependencies": {
"#types/enzyme": "^3.10.3",
"expo": "^34.0.1",
"moment": "^2.24.0",
"react": "16.9.0",
"react-dom": "^16.9.0",
"react-moment": "^0.9.2",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-elements": "^1.1.0",
"react-native-gesture-handler": "~1.3.0",
"react-native-reanimated": "~1.1.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "^0.11.4",
"react-navigation": "^3.12.1"
},
"devDependencies": {
"#types/expo": "^32.0.13",
"#types/jest": "^24.0.18",
"#types/react": "^16.9.2",
"#types/react-test-renderer": "^16.9.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"jest": "^24.9.0",
"jest-expo": "^34.0.1",
"react-test-renderer": "^16.9.0",
"ts-jest": "^24.0.2",
"tslint": "^5.19.0",
"tslint-config-airbnb": "^5.11.1",
"typescript": "^3.5.3"
},
"private": true,
"jest": {
"preset": "jest-expo",
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",
"^.+\\.tsx?$": "ts-jest"
},
"testMatch": [
"**/__tests__/**/*.ts?(x)",
"**/?(*.)+(spec|test).ts?(x)"
],
"moduleFileExtensions": [
"js",
"ts",
"tsx"
],
"globals": {
"ts-jest": {
"tsConfig": {
"jsx": "react"
}
}
},
"setupFilesAfterEnv": [
"./src/setupTests.js"
]
}
}
Any ideas how to solve that?
Step 1:
Inside the "scripts" object in your package.json simply add:
"postinstall": "npx typesync"
The benefit of using npx here is that it doesn't require you to install anything on your machine.
Step 2:
Run yarn or npm install to effectively run the 'postinstall' script.
Once all your missing packages are added, you'll get a list of all the new typings to be added to your project
It may look something like this:
📦 yourAppNameHere — package.json (4 new typings added, 0 unused typings removed)
├─ + #types/babel__core
├─ + #types/react-native-vector-icons
├─ + #types/react
Step 3:
You will likely be asked to run npm install or yarn again, which will install the packages added and you will be good to go!
I can see that you are using eslint. So, it is safe to edit your compiler options and add
"noImplicitAny": false,
this will silence your error. And eslint will catch any implicit any in your code.
I hope this is correct from my understanding :-)

Cannot use React Native CLI to initialize project with version lower than 0.60.0

I'm trying to use react-native init ABC --version 0.57.0 and it has an error. Tried to use other formats of init, but still doesn't work.
If anybody needs to install 0.59.x do this:
mkdir rn59cli
cd rn59cli
npm init -f
npm install react-native-cli
node_modules/.bin/react-native init Rn59SampleApp --version 0.59.10
Using yarn v1.21.1
Installing react-native#0.59.10...
yarn add v1.21.1
warning ../../package.json: No license field
info No lockfile found.
[1/4] 🔍 Resolving packages...
info Direct dependencies
└─ react-native#0.59.10
$ cat Rn59SampleApp/package.json
{
"name": "Rn59SampleApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.10"
},
"devDependencies": {
"#babel/core": "^7.8.4",
"#babel/runtime": "^7.8.4",
"babel-jest": "^25.1.0",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
Try re-installing react-native CLI

How to upgrade core-js#3 in react-native cli?

I am trying to create new project with react-native cli, but when I create a new project I am receiving the following error message:
react-native > create-react-class > fbjs > core-js#1.2.7: core-js#<2.6.8 is no longer maintained. Please, upgrade to core-js#3 or at least to actual version of core-js#2.
Listed below is the contents of my package.json file:
{
"name": "EmojiDictRN",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.8"
},
"devDependencies": {
"#babel/core": "^7.4.5",
"#babel/runtime": "^7.4.5",
"babel-jest": "^24.8.0",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.54.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
To see the full output from my terminal please click here. Any ideas on how to resolve this warning message?
Any help would be greatly appreciated!
Download and save the version of the core-js module which is requested within your warning message:
npm install --save core-js#^3
This will update the core-js dependency for your react-native project to use version ^3.x.x which is still being actively maintained.
Hopefully that helps!

NPM crashed by trying to install a package and use --save flag

Here is my package.json file:
{
"name": "admin",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Rateb Habedy",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.26.3",
"gulp": "^4.0.0",
"gulp-autoprefixer": "^6.0.0",
"gulp-clean": "^0.4.0",
"gulp-imagemin": "^5.0.3",
"gulp-minify-css": "^1.2.4",
"gulp-sass": "^4.0.2",
"gulp-uglify": "^3.0.2",
"gulp4-run-sequence": "^0.3.1",
"imagemin-jpeg-recompress": "^6.0.j0",
"imagemin-pngquant": "^7.0.0"
},
"dependencies": {
"del": "^4.0.0",
"gulp-rename": "^1.4.0"
}
}
I just trying to install (npm - del) package by this command: npm install del --save after that I'm not able to install any package.
It says:
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "^6.0.j0": Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/lion/.npm/_logs/2019-03-05T13_49_41_065Z-debug.log
Is there any solution for that??
The problem you have is not with npm del package, but an error, really just a typo, in your package.json file.
See the line:
"imagemin-jpeg-recompress": "^6.0.j0",
That is not a valid version tag, and is not able to be resolved. You probably want that line to read:
"imagemin-jpeg-recompress": "^6.0.0",
Once you edit that line your npm install should work correctly.

react-native-material-ui#1.12.0 requires a peer of react-native-vector- icons#^4.0.0 but none was installed

hello everyone i am new to react native and started learning the react from last week.
But now i stuck on problem that react-native-vector-icons doesn't install properly,i don't know why its happen.i am not getting what is the exact issue
here is my package.json
{
"name": "ephotobook",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.46.3",
"react-native-icons": "^0.7.1",
"react-native-material-ui": "^1.12.0"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.1.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}
}
when i run npm install react-native-vector-icons
i get the following error
`-- UNMET PEER DEPENDENCY react-native-vector-icons#^4.0.0
npm WARN react-native-material-ui#1.12.0 requires a peer of react-native-vector-
icons#^4.0.0 but none was installed.
please help me to install both material ui and vecctor icons
You can update version of react-native-vector-icon in your package.json like :
"react-native-vector-icons": "^4.0.0",
I hope this is can help you.
As mentioned in warning you need to add vector icons to package.json before installing material ui.
"react-native-vector-icons": "^4.0.0"