NPM doesn't support PnP - npm

I was trying use pnpm with create-react-app v2 as follows
npx create-react-app my-app --use-pnp
But it gives me following warning
NPM doesn't support PnP.
Falling back to the regular installs.
What should I do in order to use pnpm with create-react-app?
I already have pnpm installed globally using npm.

pnp is a Yarn feature, you need the latest version of yarn installed on your system to use it (at least Yarn 1.12).

Try
yarn create react-app project-name --use-pnp
And make sure yarn -v is >= 1.12

Related

Global parameter does not work with yarn 3

My env:
- OS: Ubuntu 20.04
- Yarn: 3.1.1
- Node: v16.12.0
Instruction link: https://cli.vuejs.org/guide/installation.html
When I run command: yarn global add #vue/cli
I got error:
Usage Error: The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead
$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
The documentation contains instructions for yarn v1.
Yarn v2 and above no longer supports the use of the global parameter.
You can view their migration guide here.
You can use yarn dlx everytime you want to run a command with vue.
Alternatively, you can install the vue cli using npm:
npm install -g #vue/cli
Yarn has removed global in v3, according to its official document.
You can use the #vue/cli the same as npx using yarn dlx without installing it globally.
yarn dlx #vue/cli do_something

Unable to find expo in this project - have you run yarn / npm install yet?

I'm Unable to execute the expo start command.
Error Message:
PS C:\Users\Jacky Goyal\OneDrive\Desktop\rn1\my-project> expo start
Starting project at C:\Users\Jacky Goyal\OneDrive\Desktop\rn1\my-project
Unable to find expo in this project - have you run yarn / npm install yet?
├─ action (C:\Users\Jacky Goyal\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:34:11)
├─ C:\Users\Jacky Goyal\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:135:22
└─ expo start (C:\Users\Jacky Goyal\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:350:7)
PS C:\Users\Jacky Goyal\OneDrive\Desktop\rn1\my-project> npm install
added 28 packages, removed 46 packages, changed 34 packages, and audited 653 packages in 8s
17 packages are looking for funding
run `npm fund` for details
7 low severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
PS C:\Users\Jacky Goyal\OneDrive\Desktop\rn1\my-project> npm audit
npm audit report
node-fetch <=2.6.0 || 3.0.0-beta.1 - 3.0.0-beta.8
Denial of Service - https://npmjs.com/advisories/1556
No fix available
node_modules/isomorphic-fetch/node_modules/node-fetch
isomorphic-fetch 2.0.0 - 2.2.1
Depends on vulnerable versions of node-fetch
node_modules/isomorphic-fetch
fbjs 0.7.0 - 1.0.0
Depends on vulnerable versions of isomorphic-fetch
node_modules/fbjs
metro 0.22.1 - 0.63.0
Depends on vulnerable versions of fbjs
Depends on vulnerable versions of metro-config
node_modules/metro
#react-native-community/cli *
Depends on vulnerable versions of metro
Depends on vulnerable versions of react-native
node_modules/#react-native-community/cli
react-native <=0.0.0-ffdfbbec0 || 0.22.0-rc - 0.64.0-rc.4
Depends on vulnerable versions of #react-native-community/cli
Depends on vulnerable versions of fbjs
node_modules/react-native
metro-config <=0.63.0
Depends on vulnerable versions of metro
node_modules/metro-config
7 low severity vulnerabilities\
Some issues need review, and may require choosing
a different dependency```
Change expo version from "^1.0.0" to "~41.0.1" (package.json)
npm install
npm start
if anyone is still facing issues, run
yarn add expo
if you don't have yarn installed on your computer then run
npm install -g yarn
and then run the first command.
I also received your message when installing the commands in the "React Navigation" set-up instructions and fixing vulnerabilities. The problem arises when using the command: npm audit fix --force. If you check the warnings after this command, you get
npm WARN audit Updating expo to 1.0.0, which is a SemVer major change.
So, try running: sudo expo update
If that doesn't work, try installing expo again with: npm install --global expo-cli and then update.
I'm also facing this error. So I run the npm command in the terminal.
npm install
You do not need to change the expo version. you just reinstall it.
Update the Expo to the latest version sudo expo update
Then install the updated npm packages npm install
Fix the issues in the packages npm audit fix --force
Run the Application npm start or expo start
Error ? you are trying to launch the expo framework yet it can't be found installed as part of your application modules
solution? simply find the latest version of Expo i.e for my case "expo": "^44.0.0", then go to your package.json file in your root folder, under the "dependencies" property plug-in that Expo version i.e
"dependencies":{
"expo": "^44.0.0",
}
close package.json file, then in your root folder run the command: npm install
after package installation is done run expo start
I simply used the expo update command.
It asked me
You are currently using SDK 1.0.0. Would you like to update to the
latest version, 44.0.0?
and I said yes, y not..
Every Thing was good to go with the npm start command
Cheers..
See the expo version - default "^1.0.0" , change ==> "expo": "~41.0.1"
Change expo to version "~43.0.0" in package.json
run npm audit fix --force in node_modules directory
here are my 2 cents. This worked for me :
Download latest version of nodejs - https://nodejs.org/en/download/
After installing nodejs reboot your computer
install : npm install --global expo-cli
Generate a new project with - npx expo-cli init projectName
cd projectName
npm start
you can run the below to install all dependencies
npm i
or to install exp
npm i -g expo-cli
This problem I faced was because of cloning a new project and trying to run it.
Always install the modules using the below command
I solved this by
npm install or npm i
I had same problem.
I simply used the expo update command.
You are currently using SDK 1.0.0. Would you like to update to the latest version, 44.0.0?
and I said yes.
Every Thing was good to go with the npm start command
thats all
Is possible that you need an update try this command:
sudo expo update
Please try this
npm install --save expo --legacy-peer-deps
no need to edit package.json if expo version is not 1.0.0
You should register first on expo and then login
I had the same issue but after I logged in it was solved.
here is all about : https://docs.expo.dev/get-started/installation/
In my case, I clonned a Github repository and then used create-expo-app inside the repository directory. So, the command created a directory with the name of the app, but I was not in it: I was running the expo run command in the wrong directory.
Double check that the package.json is in the same directory in which you are running yarn or expo run to avoid this simple mistake.
The same error happened to me. But none of the other answers helped me. In my situation, I have node.js v18.12.1 installed. But when I check with nvm ls, the arrow points to "system", and on my system Xubuntu 22.04, the nodejs version installed is v12.22.9. So I needed to do nvm use 18, then
yarn add expo
expo start
Problem solved!
for window users
just type expo update into your terminal,

Globally installation of packages with npm

I have a question regarding the package manager npm and the meaning of installing the package globally.
For example I work often with react, should I install react globally?
npm install -g react react-dom
Does this mean that next time when I do
npx creat-react-app my-app
It will get the package from the global or it does not matter and it will still download it locally inside my-app?
Because I really do not understand the idea behind installing globally.
Because if I want to use a package it should be mentioned in package.json, if it is in package.json it is then located in node_module ... so yeah ...
Could anyone give me better insight?
Thanks in advance
React library can be installed globally on your local machine. In development there is no real reason to do that since you might not have the latest version and this might cause issues.
Better practise is to use react on project level by using the command you stated above npx create-react-app my-app
If you push code to a server the package.json file will install the dependencies (React, React DOM,..) to build your project.
Read more here : https://create-react-app.dev/docs/getting-started/
If you've previously installed create-react-app globally via npm
install -g create-react-app, we recommend you uninstall the package
using npm uninstall -g create-react-app or yarn global remove
create-react-app to ensure that npx always uses the latest version.
You can check what packages are installed globally using:
npm list -g --depth 0

How to use Create React App using Yarn 2?

In yarn v1 we initialize create react app using yarn create react-app my-app. How to initialize the same in yan v2.
The above command gives the error
Usage Error: No project found in <<directory>>
$ yarn run <scriptName> ...
Check your yarn version:
yarn --version
If it's below 1.22 you may need to upgrade it to use yarn 2:
npm install -g yarn
You can then create your app:
yarn create react-app my-app
cd my-app
yarn set version berry
yarn
yarn start
This should have your react app up and running using yarn 2. You may want to remove the node_modules folder:
rm -R node_modules
Also, you need the next line on .yarnrc.yml
nodeLinker: "node-modules"
You can use yarn dlx create-react-app my-app. It will work.
There are a lot of changes came with the yarn version2 update.
check this also for additional info: https://dev.to/arcanis/introducing-yarn-2-4eh1

Can "yarn add global " update packages installed by npm?

I use yarn as package-manager but the first time I install nativescript I used;
npm install -g nativescript
Can I update the package using yarn add global nativescript?
NOTE: I run tns package-manager set yarn in my projects folder
Yes ;
yarn global add nativescript
and
yarn global upgrade
updates packages which are installed by npm
Please consider checking migrating from npm
Thanks to #Manoj for answer