I create a website with ReactJs. and Its worked correctly. but now when I run the project yarn dev or npm run dev I got this error
yarn run v1.22.17
error An unexpected error occurred: "C:\\Users\\my location\\package.json: Unexpected token < in JSON at position 2".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\my location \\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
and this is my package.json
{
"name": "test",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"#headlessui/react": "^1.6.6",
"#react-pdf-viewer/default-layout": "^3.6.0",
"#react-pdf-viewer/thumbnail": "^3.6.0",
"#reduxjs/toolkit": "^1.8.5",
"axios": "^0.27.2",
"jsonwebtoken": "^8.5.1",
"react": "^18.2.0",
"react-addons-update": "^15.6.3",
"react-cookie": "^4.1.1",
"react-cookies": "^0.1.1",
"react-dom": "^18.2.0",
"react-google-recaptcha": "^2.1.0",
"react-icons": "^4.4.0",
"react-media-recorder": "^1.6.6",
"react-multi-date-picker": "^3.3.0",
"react-redux": "^8.0.2",
"react-router-dom": "^6.3.0",
"react-select": "^5.4.0",
"react-spinners": "^0.13.3",
"react-transition-group": "^4.4.5",
"redux-persist": "^6.0.0",
"validator": "^13.7.0"
},
"devDependencies": {
"#types/jsonwebtoken": "^8.5.8",
"#types/react": "^18.0.0",
"#types/react-addons-update": "^0.14.21",
"#types/react-dom": "^18.0.0",
"#types/react-google-recaptcha": "^2.1.5",
"#types/validator": "^13.7.4",
"#vitejs/plugin-react": "^1.3.0",
"autoprefixer": "^10.4.7",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.4",
"typescript": "^4.6.3",
"vite": "^2.9.9"
}
}
I also use eslint and add my package.json content to this site and I got this error
on colon after "name":"test"
2:9
Parsing error: Unexpected token
:
and also remove node_module and reinstall the package with npm install. but the error still occurs.
Related
Very simply by using the following command, I am unable to install React-chartJs-2 module in my React Parcel project:
npm install --save chart.js react-chartjs-2
After the installation when i started my project using (npm start), i getting the following error:
#parcel/core: Failed to resolve 'react-chartjs-2' from './src/pages/dashboard/quiz-detail.js'
My package.json after installation is looks like:
{
"name": "quizcopy",
"version": "1.0.0",
"homepage": ".",
"description": "",
"source": "/src/index.html",
"scripts": {
"start": "parcel",
"build": "parcel build src/index.html"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#parcel/transformer-sass": "^2.7.0",
"autoprefixer": "^10.4.8",
"buffer": "^6.0.3",
"parcel": "^2.7.0",
"postcss": "^8.4.16",
"process": "^0.11.10",
"sass": "^1.54.9",
"tailwindcss": "^3.1.8"
},
"dependencies": {
"#headlessui/react": "^1.7.0",
"#heroicons/react": "^2.0.10",
"axios": "^0.27.2",
"chart.js": "^4.1.1",
"crypto-js": "^4.1.1",
"dotenv": "^16.0.2",
"js-cookie": "^3.0.1",
"moment": "^2.29.4",
"react": "^18.2.0",
"react-chartjs-2": "^5.1.0",
"react-datetime-picker": "^4.0.1",
"react-dom": "^18.2.0",
"react-export-table-to-excel": "^1.0.6",
"react-google-recaptcha-v3": "^1.10.0",
"react-hot-toast": "^2.4.0",
"react-image-file-resizer": "^0.4.8",
"react-quill": "^2.0.0",
"react-router-dom": "^6.3.0",
"react-transition-group": "^4.4.5",
"read-excel-file": "^5.5.3",
"swr": "^1.3.0"
}
}
I've got a NextJS site running TypeScript and a component of it in a separate repo installed using npm, but when I try and use the component in the site it shows the following message:
error - ./node_modules/promotion-spot/dist/PromotionSpot/Conditional/index.jsx
Module parse failed: Unexpected token (11:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
The component works fine when it isn't in a separate npm dependency but, when it is, NextJS won't load it properly. The component is compiled into JavaScript with .d.ts files and I saw that react-chrono does something similar and that works in the site fine.
The component's source code is at https://github.com/Relucent-Software/promotion-spot.
Here's the package.json file for the NextJS site too:
{
"name": "thederbyinn.co.uk",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "npm-run-all test:*",
"test:eslint": "eslint --ext .ts --ext .js --ext .tsx --ext .jsx src/**/*"
},
"dependencies": {
"#types/react-gtm-module": "^2.0.1",
"animate.css": "^4.1.1",
"classnames": "^2.3.1",
"formik": "^2.2.9",
"libphonenumber-js": "^1.9.53",
"lodash.get": "^4.4.2",
"luxon": "^2.4.0",
"next": "^12.1.6",
"next-seo": "^4.29.0",
"promotion-spot": "github:Relucent-Software/promotion-spot",
"query-string": "^7.1.1",
"react": "17.0.2",
"react-chrono": "^1.15.0",
"react-dom": "17.0.2",
"react-gtm-module": "^2.0.11",
"react-icons": "^4.3.1",
"react-masonry-css": "^1.0.16",
"sass": "^1.51.0",
"schema-dts": "^1.1.0",
"swiper": "^7.4.1",
"tailwindcss": "^2.2.19",
"webfontloader": "^1.6.28"
},
"devDependencies": {
"#babel/core": "^7.17.10",
"#types/lodash.get": "^4.4.7",
"#types/lodash.has": "^4.5.7",
"#types/luxon": "^2.3.2",
"#types/node": "16.11.7",
"#types/react": "17.0.35",
"#types/react-datepicker": "^4.4.1",
"#typescript-eslint/eslint-plugin": "^5.23.0",
"#typescript-eslint/parser": "^5.23.0",
"autoprefixer": "^10.4.7",
"babel-loader": "^8.2.5",
"eslint": "^8.15.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-n": "^15.2.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.5.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.13",
"typescript": "4.4.4"
}
}
I am using Nextjs and Vercel to deploy my website. Cypress was working fine yesterday. But today when Vercel runs the build I get the following error:
I noticed that vercel was installing Cypress version 6.9.0 whereas I had 6.8.0 in my package.json file.
So I updated to version to 6.9.0 but I still get the same error. Why is this suddenly happening?
My package.json file
{
"name": "website",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "cross-env API_URL=http://localhost:1337 next dev",
"public-dev": "next dev",
"build": "next build",
"start": "next start",
"cypress:open": "cypress open"
},
"dependencies": {
"#apollo/client": "^3.1.3",
"#blueprintjs/core": "^3.35.0",
"#blueprintjs/datetime": "^3.19.3",
"#popperjs/core": "^2.5.4",
"axios": "^0.21.1",
"graphql": "^15.3.0",
"graphql-tag": "^2.10.4",
"isomorphic-unfetch": "^3.1.0",
"moment": "^2.29.1",
"next": "10.0.2",
"next-with-apollo": "^5.1.0",
"nouislider-react": "^3.3.8",
"react": "^17.0.1",
"react-copy-to-clipboard": "^5.0.2",
"react-dom": "^17.0.1",
"react-flatpickr": "^3.10.6",
"react-froala-wysiwyg": "^3.2.1",
"react-ga": "^3.2.1",
"react-gtm-module": "^2.0.11",
"react-localization": "^1.0.15",
"react-lottie": "^1.2.3",
"react-popper": "^2.2.3",
"react-scroll": "^1.8.1",
"react-slick": "^0.27.13",
"sass": "^1.30.0",
"swiper": "^6.3.5",
"swr": "^0.4.2"
},
"devDependencies": {
"#types/node": "^14.0.27",
"#types/react": "^16.9.46",
"cross-env": "^7.0.2",
"cypress": "^6.9.0",
"cypress-localstorage-commands": "^1.4.2",
"eslint": "^7.4.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-standard": "^4.0.1",
"typescript": "^3.9.7"
}
}
Cypress team published 6.9.0 by mistake, really the version is 7.0.0 and they will remove 6.9.0:
https://github.com/cypress-io/cypress/issues/15797
I am trying to run my app on Android but I am getting this error I don't know why I am getting this, I don't know what is causing this error in my project
I have tried tried many ways to resolve this issue but Still wasn't able to resolve this issue.
Tried To register two Views with the same name RTCVideoView
My Package.json is
{
"name": "Hello World",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#ptomasroos/react-native-multi-slider": "^1.0.0",
"#react-native-community/async-storage": "^1.6.2",
"#react-native-community/slider": "^2.0.0",
"axios": "^0.19.0",
"connectycube-reactnative": "^1.7.3",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-autogrow-textinput": "^5.2.0",
"react-native-cache-store": "^1.0.2",
"react-native-calendars": "^1.212.0",
"react-native-deck-swiper": "^1.6.7",
"react-native-image-picker": "^1.1.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-modal-datetime-picker": "^7.5.0",
"react-native-navigation": "^3.0.0",
"react-native-scrollable-tab-view": "^0.10.0",
"react-native-swiper": "^1.5.14",
"react-native-vector-icons": "^6.6.0",
"react-native-view-overflow": "^0.0.4",
"react-native-webrtc": "^1.75.0",
"react-redux": "^7.1.1",
"redux": "^4.0.4",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"rn-prompt": "^1.0.4"
},
"devDependencies": {
"#babel/core": "^7.6.0",
"#babel/runtime": "^7.6.0",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.4.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
Any Help Would be Appreciated.
All you need is just clean up the cache by the following command
npm cache clean --force
This will resolve your problem most probably
The version of react-native-webrtc you have specified in your package.json is different from the version that connectycube-reactnative depends on. The latest connectycube-reactnative (1.8.0) depends on "react-native-webrtc": "1.69.1".
Double check the dependency of the version you have installed by looking at the node_modules/connectycube-reactnative/package.json and match the version specified in your package.json to the version the connectycube-reactnative requires.
The #arzundo answer is correct
And seems this issue is addressed in latest releases here https://github.com/ConnectyCube/connectycube-reactnative-samples/tree/master/RNVideoChat so you can simply try to pull the latest master
I am trying to build one project and am facing issues during yarn build with react router types. Project is not mine and I do not have any significant prior experience with react or typescript but I need to build it. Any help would be much appreciated, thanks.
OUTPUT:
Failed to compile.
/home/marek/devel/builds/ob1/src/webclient/node_modules/#types/react-router/index.d.ts
(141,37): error TS2694: Namespace 'React' has no exported member 'Context'.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Makefile:185: recipe for target 'webclient' failed
make: *** [webclient] Error 1
Also attaching package.json provided with the project.
package.json:
{
"name": "obelisk_miner_ui",
"version": "0.1.0",
"private": true,
"dependencies": {
"#types/classnames": "2.2.3",
"#types/enzyme": "2.8.11",
"#types/jest": "21.1.1",
"#types/lodash": "4.14.106",
"#types/loglevel": "1.5.1",
"#types/node": "8.0.31",
"#types/prop-types": "15.5.3",
"#types/react": "16.3.8",
"#types/react-dom": "16.0.5",
"#types/react-redux": "5.0.9",
"#types/react-router-dom": "4.2.7",
"#types/recharts": "1.0.23",
"#types/redux-logger": "3.0.5",
"axios": "0.17.1",
"classnames": "2.2.5",
"csx": "8.5.0",
"enzyme": "3.1.0",
"formik": "0.11.11",
"isemail": "3.0.0",
"lodash": "4.17.4",
"loglevel": "1.5.0",
"moment": "2.22.2",
"query-string": "5.1.0",
"react": "16.3.1",
"react-copy-to-clipboard": "5.0.1",
"react-dom": "16.3.1",
"react-dropzone": "4.2.13",
"react-redux": "5.0.6",
"react-router-dom": "4.3.1",
"react-scripts-ts": "2.7.0",
"react-typestyle": "0.3.0",
"recharts": "1.0.0-beta.10",
"redux": "3.7.2",
"redux-batch-enhancer": "0.1.3",
"redux-logger": "3.0.6",
"redux-logic": "0.12.3",
"reselect": "3.0.1",
"semantic-ui-css": "2.2.12",
"semantic-ui-forest-themes": "1.0.3",
"semantic-ui-react": "0.82.0",
"typescript": "2.8.1",
"typescript-fsa": "2.5.0",
"typestyle": "1.4.1",
"updeep": "1.0.0",
"valid-url": "1.0.9"
},
"resolutions": {
"#types/react": "16.3.8"
},
"devDependencies": {},
"scripts": {
"start": "react-scripts-ts start",
"build": "react-scripts-ts build",
"test": "react-scripts-ts test --env=jsdom --setupTestFrameworkScriptFile=raf/polyfill",
"eject": "react-scripts-ts eject"
},
"proxy": {
"/api": {
"target": "http://192.168.1.41"
}
}
}