How to remove a dependency in my NPM manifest? - npm

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?

Related

Error while I create a new Npm project it says error while installing dependencies

enter image description here
While creating a npm project I am getting this error.
But when I install yarn.
I don't know how to rerun the program.
Or is it because I installation problem.
Is using the latest version of node an issue.
Can Someone help me with this?
the strapi supports node version up to 18, you can check it here https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/installation/cli.html#preparing-the-installation
there is flag for npm you can try to use:
npx create-strapi-app /appname --ignore-engines
However I doubt it would work, the workflow with yarn:
yarn create strapi-app /appname
If error still persists you can try to open your project with VS code or whatever IDE you use… Open terminal, do:
yarn --ignore-engines
yarn build --ignore-engines
yarn develop --ignore-engines
If that won’t help, it should give you another, more detailed error message that you should post then here…

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

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

command yarn create react-app issues engine and module

I am trying to create-react-app with typescript as I have done many times to start a new project. It says I have a missing module so I updated my brew, updated yarn, updated node, I see the issue with the engine not compatible with the module but I am not sure how to update the engine either if It deletes everything
stephens-MacBook-Pro:MobX stephen$ yarn create react-app mobx_course --template typescript
yarn create v1.22.10
[1/4] πŸ” Resolving packages...
[2/4] 🚚 Fetching packages...
warning Pattern ["object-assign#latest"] is trying to unpack in the same destination "/Users/stephen/Library/Caches/Yarn/v6/npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863-integrity/node_modules/object-assign" as pattern ["object-assign#^4.1.0","object-assign#^4"]. This could result in non-deterministic behavior, skipping.
[3/4] πŸ”— Linking dependencies...
[4/4] πŸ”¨ Building fresh packages...
success Installed "create-react-app#4.0.1" with binaries:
- create-react-app
Creating a new React app in /Users/stephen/Desktop/MobX/mobx_course.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...
yarn add v1.22.10
[1/4] πŸ” Resolving packages...
[2/4] 🚚 Fetching packages...
error browserslist#4.14.7: The engine "node" is incompatible with this module. Expected version "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7". Got "13.5.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts cra-template-typescript --cwd /Users/stephenbilham/Desktop/MobX/mobx_course has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting mobx_course/ from /Users/stephen/Desktop/MobX
Done.
error Command failed.
Exit code: 1
Command: /usr/local/bin/create-react-app
Arguments: mobx_course --template typescript
Directory: /Users/stephen/Desktop/MobX
Output:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
stephens-MacBook-Pro:MobX stephen$
Can you try yarn create-react-app ...?
Notice the - between create and react.
I believe the convention is to always have it linked with hyphens, e.g.
create-react-app
create-next-app
create-strapi-app
To give the solution for this error: you need to make sure your node -v is up to date mine was 13.5 and not compatible anymore so I updated it to 14.5

React Native build Error (AccessibilityInfo does not Exist)

Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module AccessibilityInfo from E:\react-apps\Whatsapp\node_modules\react-native\Libraries\react-native\react-native-implementation.js: Module AccessibilityInfo does not exist in the Haste module map
As you have react-native version "0.44.0" and react with version "16.3.1", as per the document you must have correct versions dependencies. Please upgrade your react native version.
Please refer this link for more details https://github.com/react-community/create-react-native-app/blob/master/VERSIONS.md
remove node_modules folder from your project. Also use below commands:
npm prune
npm cache clear
npm cache clean --force
npm start -- --reset-cache
npm i

Configure a Create-React-Native-App project to use MobX and use Babel to enable decorators

I've created a project with CRNA and after some considerations I've decided to go with MobX for state management. MobX works best with the decorator syntax (most MobX documentation is written using the decorator syntax) so I wanted to install the Babel plugin enabling the use of decorators.
I've successfully installed MobX (yarn add mobx mobx-react), but after installing the Babel plugin to enable decorators (npm install --save-dev babel-plugin-transform-decorators and adding "transform-decorators" to the plugins section in .babelrc, yarn start stopped working throwing an error about react-native-scripts not being found.
I've then run yarn installand this time it threw an error saying
Error starting packager: TypeError: Invalid Version: undefined
at new SemVer (D:\Projects\ReactNativePlayground\omar\MRKT\node_modules\semver\semver.js:279:11)
at Function.major (D:\Projects\ReactNativePlayground\omar\MRKT\node_modules\semver\semver.js:551:10)
at D:\xdl\src\project\Doctor.js:634:18
at D:\Projects\ReactNativePlayground\omar\MRKT\node_modules\lodash\lodash.js:4944:15
at baseForOwn (D:\Projects\ReactNativePlayground\omar\MRKT\node_modules\lodash\lodash.js:3001:24)
at D:\Projects\ReactNativePlayground\omar\MRKT\node_modules\lodash\lodash.js:4913:18
at Function.forEach (D:\Projects\ReactNativePlayground\omar\MRKT\node_modules\lodash\lodash.js:9359:14)
at D:\xdl\src\project\Doctor.js:624:9
at Generator.throw (<anonymous>)
at step (D:\Projects\ReactNativePlayground\omar\MRKT\node_modules\xdl\build\project\Doctor.js:615:191)
error Command failed with exit code 1.
Does anyone have experience with CRNA and MobX? Any help is much appreciated!
I've solved it. Turns out that running npm install --save-dev babel-plugin-transform-decorators broke something. What I should have been running is yarn add --dev babel-plugin-transform-decorators-legacy and add "transform-decorators-legacy" to .babelrc plugins section. After doing those steps I ran yarn install and it fixed my project.
Additionally, my editor (VSCode) threw warnings about extensions being experimental so I added a jsconfig.json file to the root folder and added the following inside:
{
"compilerOptions": {
"experimentalDecorators": true
},
"exclude": [".expo/*", "node_modules/*"]
}