简体   繁体   中英

Installing React app with yarn Plug n Play

I want to make a react app with yarn using PnP(Plug and Play), so that I can install any dependencies without using node modules, so I type this in terminal:

yarn create react-app project-name --use-pnp

Then, the app has created, but when I start the server it says

    Failed to compile.

    ./src/App.js
    Module not found: You cannot require a package ("react-refresh") that is not declared in your dependencies (via "/home/path/path/path/path/project-name/src/App.js")

Then, when I install the "react-refresh" it gives me another error.
Is it possible to create react app with PnP?

After some research, it seems to be a Yarn issue with the v1.12, which version do you have and this link helped you?

https://github.com/facebook/create-react-app/issues/5255

Currently i don't use yarn pnp, use pnpm instead if you want to save your storage.

npm i -g pnpm

pnpm will save your disk space out of the box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM