Error: ": Unexpected token \u0000 in JSON at position 0" when using yarn to add a react package - npm

I am trying to install the following package through yarn yarn add react-native-gesture-handler#1.10.2. I read multiple answers to this question yet none was of use. I think the problem might come from the fact I am on a windows computer yet don't know how to solve it.
Whenenever y try to do a yarn add ..#version I get the following error:
yarn add v1.22.11
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is
advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "C:\\Users\\...\\AppData\\Local\\Yarn\\Cache\\v6\\npm-unbox-primitive-1.0.1-085e215625ec3162574dc8859abee78a59b14471-integrity\\node_modules\\unbox-primitive\\.yarn-metadata.json:
Unexpected token \u0000 in JSON at position 0".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\...\\OneDrive\\Documents\\GitHub\\wc_app\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

I have same problem with installing next.js app many times
now its fixed
with clear cache of yarn
yarn cache clean

I have faced a similar problem while creating a latest react native project(0.65) in my Windows machine:
error An unexpected error occurred: "C:\Users\arefin\AppData\Local\Yarn\Cache\v6\npm-is-ci-3.0.0-c7e7be3c9d8eef7d0fa144390bd1e4b88dc4c994-integrity\node_modules\is-ci\.yarn-metadata.json: Unexpected token \u0000 in JSON at position 0".
My system configuration for react native development is as follows:
node --version: v15.7.0
yarn --version: 1.22.5
npm --version: 7.12.1
java --version: java 15.0.2 2021-01-19
I used these commands below, which finally solved the problem in my case:
yarn init && yarn add react-native && yarn react-native init
SpendnGain
which I found at here

Related

How to remove a dependency in my NPM manifest?

Goal: Create a CRA TypeScript app with Yarn.
I run yarn create react-app my-app --template typescript on my terminal. Then I encounter the ff. error message:
yarn create v1.22.10
[1/4] Resolving packages...
warning create-react-app > tar-pack > tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
[2/4] Fetching packages...
error create-strapi-app#3.6.3: The engine "node" is incompatible with this module. Expected version ">=10.16.0 <=14.x.x". Got "16.14.2"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
And it's super weird and confusing because I'm not trying to create a Strapi project. I check yarn-error.log and I see these lines after the Error Stack Trace:
npm manifest:
{
"dependencies": {
"create-strapi-app": "^3.6.3"
}
}
yarn manifest:
No manifest
So I'm thinking either CRA requires CSA, or somehow my local NPM is configured to always require CSA. I very much doubt the former, so I'm betting it's the latter. (Please correct me if I'm wrong.) Either way, any ideas how I may resolve this?

Expo keeps crashing with error message - dyld: Symbol not found: _FSEventStreamCreate Abort Trap 6

Expo was working fine until I did an npm install native-base --save and it keeps crashing every time I try to start it. I'm on Mac and have am using my real mobile devices to view the changes in my project.
I've uninstalled the native-base but am not sure how to replace the missing files.
Refer to error message screenshot here
Managed to find a solution for now (thanks to #brentvatne).
I updated the packages, including node:
brew update
brew upgrade node
And when I started Expo, another error came up - EMFILE: too many open files, watch at FSEvent.FSWatcher._handle.onchange
The error is caused by Watchman, to which I resolved it with:
brew install watchman

How can i solve this vue related issue

Am trying to create a vue project using command line but it is showing this error message:
Error unexpected end ofJSON input while parsing near '....67e12ef","tarball":"h'
Using command line, I created a new project in C directory after which, I installed vue using NPM. After that I try installing #vue/CLI globally using NPM but while installing it the above error sprout out.
Have done npm cache clean --force but still the same error..
It is hard to suggest anything because your question lacks details.
However this error often appears as a problem with npm itself.
Consider cleaning npm's cache with following commands:
npm cache clean --force
npm cache verify
If the problem will still occur, please provide more details.

Problem validating app.json: Unable to perform cache refresh

i had everything working fine, great tool Expo. however, after updating the expo (npm i -g expo --save) i started getting this problem.
i managed to solve the invalid version issue by adding "sdkVersion": "38.0.0" to my app config - but it was working fine before that. don't know why it started appearing now. struggling to solve "unknown option `--assetExts'" issue here, could you please help ?
Warning: Problem validating app.json: Unable to perform cache refresh
for \schema-undefined.json: Error: Request failed with status code 404.
Error: Invalid sdkVersion. Valid options are 7.0.0, 8.0... 38.0.0
error: unknown option `--assetExts'
Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
Problem got fixed for me after updating the expo-cli to the latest version:
npm install -g expo-cli
I had the same problem, what solved it for me was clearing the react-native packager cache.
I ran: expo start --clear
Expo cli docs:
https://docs.expo.io/workflow/expo-cli/
In my package I added:
"start:clear": "expo start --clear",
just to help in the future...

Error: Can't resolve 'stream' in .... papaparse

Im getting this error using ngx-papaparse in angular. It was working, I then tried adding jquery to my project, and in the process was warned of security issues, so I followed instructions and tried npm audit fix. In the process something seems to have gone awry and now I'm getting...
ERROR in ./node_modules/papaparse/papaparse.min.js Module not found:
Error: Can't resolve 'stream' in
'/mnt/c/Users/j2wil/Documents/CodingDojo/projects/Scouts/public/node_modules/papaparse
I've tried a number of things including removing node_modules and npm install. Also deleting packages.json and reinstalling. But I keep seeing the same error.
I had the similar issue. Please try installing the stream package.
npm install stream --save