question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: yarn with PnP support

See original GitHub issue

Bug Report

Ionic version:

  • 5.5.0

*Note: I tried both node versions 14.16.0 and 15.8.0.

Current behavior:

Creating a new, blank Ionic React app and using the latest yarn to initialize and run the project results in catastrophic failure related to inability to find dependencies.

For more information, see Yarn 2 β€œZero Installs” documentation: https://yarnpkg.com/features/zero-installs

*Note: I did verify that the commands npm i, npm test, and npm start do work correctly with the same versions without any issue.

Expected behavior:

Tests run and project starts successfully. Ideally, zero warnings (but, I recognize you don’t own the entire package dependency tree).

Steps to reproduce:

  1. Create a new Ionic React app: npx ionic start helloworld blank --type=react --no-git --no-deps
  2. cd helloworld
  3. yarn set version berry
  4. yarn install
  5. yarn test (q to stop test β€œwatch”)
  6. yarn start

Related code:

n/a

Other information:

Logs…

➜  helloworld.app git:(main) βœ— npx ionic start helloworld blank --type=react --no-git --no-deps
[INFO] Existing git project found (/mnt/c/Users/iseri/src/github/ourchitecture/helloworld.app). Git operations are
       disabled.
βœ” Preparing directory ./helloworld - done!
βœ” Downloading and extracting blank starter - done!


[INFO] Next Steps:

       - Go to your newly created project: cd ./helloworld
       - Run ionic serve within the app directory to see your app
       - Build features and components: https://ion.link/scaffolding-docs
       - Run your app on a hardware or virtual device: https://ion.link/running-docs

  ────────────────────────────────────────────────────────────

          Ionic CLI update available: 5.4.16 β†’ 6.13.1

     The package name has changed from ionic to @ionic/cli!

             To update, run: npm uninstall -g ionic
                 Then run: npm i -g @ionic/cli

  ────────────────────────────────────────────────────────────

➜  helloworld.app git:(main) βœ— mv -v helloworld/* ./
renamed 'helloworld/ionic.config.json' -> './ionic.config.json'
renamed 'helloworld/package.json' -> './package.json'
renamed 'helloworld/public' -> './public'
renamed 'helloworld/src' -> './src'
renamed 'helloworld/tsconfig.json' -> './tsconfig.json'
➜  helloworld.app git:(main) βœ— rm -rf helloworld 
➜  helloworld.app git:(main) βœ— yarn set version berry
Resolving berry to a url...
Downloading https://github.com/yarnpkg/berry/raw/master/packages/berry-cli/bin/berry.js...
Saving it into /mnt/c/Users/iseri/src/github/ourchitecture/helloworld.app/.yarn/releases/yarn-berry.cjs...
Updating /mnt/c/Users/iseri/src/github/ourchitecture/helloworld.app/.yarnrc.yml...
Done!
➜  helloworld.app git:(main) βœ— yarn install
➀ YN0000: β”Œ Resolution step
➀ YN0061: β”‚ babel-eslint@npm:10.1.0 is deprecated: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
➀ YN0032: β”‚ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➀ YN0032: β”‚ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➀ YN0061: β”‚ chokidar@npm:2.1.8 is deprecated: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
➀ YN0061: β”‚ fsevents@npm:1.2.13 is deprecated: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
➀ YN0061: β”‚ fsevents@npm:1.2.13 is deprecated: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
➀ YN0061: β”‚ @hapi/joi@npm:15.1.1 is deprecated: Switch to 'npm install joi'
➀ YN0061: β”‚ @hapi/address@npm:2.1.4 is deprecated: Moved to 'npm install @sideway/address'
➀ YN0061: β”‚ @hapi/bourne@npm:1.3.2 is deprecated: This version has been deprecated and is no longer supported or maintained
➀ YN0061: β”‚ @hapi/topo@npm:3.1.6 is deprecated: This version has been deprecated and is no longer supported or maintained
➀ YN0061: β”‚ @hapi/hoek@npm:8.5.1 is deprecated: This version has been deprecated and is no longer supported or maintained
➀ YN0061: β”‚ request@npm:2.88.2 is deprecated: request has been deprecated, see https://github.com/request/request/issues/3142
➀ YN0032: β”‚ evp_bytestokey@npm:1.0.3: Implicit dependencies on node-gyp are discouraged
➀ YN0061: β”‚ har-validator@npm:5.1.5 is deprecated: this library is no longer supported
➀ YN0061: β”‚ urix@npm:0.1.0 is deprecated: Please see https://github.com/lydell/urix#deprecated
➀ YN0061: β”‚ resolve-url@npm:0.2.1 is deprecated: https://github.com/lydell/resolve-url#deprecated
➀ YN0061: β”‚ request-promise-native@npm:1.0.9 is deprecated: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
 FAIL  src/App.test.tsx
  ● Test suite failed to run

    @ionic/react-router tried to access history, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

    Required package: history (via "history")
    Required by: @ionic/react-router@virtual:f122e2e0fc619083f1222d16db756a72e907cbf4082314c1e6b01e0171a948d0bef8b5fc91c1be8cfe7c332f514e52c96ac625fbd90689b1d0489b9cec8f1ce7#npm:5.6.3 (via /mnt/c/Users/iseri/src/github/ourchitecture/helloworld.app/.yarn/$$virtual/@ionic-react-router-virtual-0ec5b48533/0/cache/@ionic-react-router-npm-5.6.3-734f8999e5-a4232fa611.zip/node_modules/@ionic/react-router/dist/)


    Require stack:
      .yarn/$$virtual/@ionic-react-router-virtual-0ec5b48533/0/cache/@ionic-react-router-npm-5.6.3-734f8999e5-a4232fa611.zip/node_modules/@ionic/react-router/dist/index.js      
      src/App.tsx
      src/App.test.tsx

      25134 |     enumerable: false
      25135 |   };
    > 25136 |   return Object.defineProperties(new Error(message), {
            |                                  ^
      25137 |     code: { ...propertySpec,
      25138 |       value: code
      25139 |     },

      at internalTools_makeError (.pnp.js:25136:34)
      at resolveToUnqualified (.pnp.js:26101:23)
      at resolveRequest (.pnp.js:26193:29)
      at Object.resolveRequest (.pnp.js:26271:26)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        6.657 s
Ran all test suites related to changed files.

Watch Usage
 β€Ί Press a to run all tests.
 β€Ί Press f to run only failed tests.
 β€Ί Press q to quit watch mode.
 β€Ί Press p to filter by a filename regex pattern.
 β€Ί Press t to filter by a test name regex pattern.
 β€Ί Press Enter to trigger a test run.

Ionic info:

➜  helloworld.app git:(main) βœ— npx ionic info
[ERROR] Error loading @ionic/react package.json: Error: Cannot find module '@ionic/react/package'

        Require stack:
        - /home/myuser/.npm/_npx/864a9e3c2cd0cf50/node_modules/ionic/lib/project/index.js
        - /home/myuser/.npm/_npx/864a9e3c2cd0cf50/node_modules/ionic/lib/index.js
        - /home/myuser/.npm/_npx/864a9e3c2cd0cf50/node_modules/ionic/index.js
        - /home/myuser/.npm/_npx/864a9e3c2cd0cf50/node_modules/ionic/bin/ionic

Ionic:

   Ionic CLI       : 5.4.16 (/home/myuser/.npm/_npx/864a9e3c2cd0cf50/node_modules/ionic)
   Ionic Framework : not installed

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v15.8.0 (/home/myuser/.nvm/versions/node/v15.8.0/bin/node)
   npm    : 7.5.1
   OS     : Linux 5.4

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ericiscommented, Apr 9, 2021

@merceyz I noticed you are a Yarn Berry contributor, so I’ll just trust your expertise and rename πŸ˜‰ πŸ‘πŸ»

2reactions
liamdebeasicommented, Apr 6, 2021

Thanks for the issue. We do not have plans for full Yarn 2 support at the moment, but I will keep this issue open for now to gauge interest and collect feedback from the community.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plug'n'Play | Yarn - Package Manager
Initializing PnP. PnP loose mode. Caveat. Alternatives. Compatibility Table. Native support; Support via plugins; Incompatible. Frequently Asked Questions.
Read more >
feat(remix-dev): add support for Yarn 3 PnP #1316 - GitHub
I'm open for suggestions regarding the remix package issues with PnP and happy to implement them, if that will get PnP support added...
Read more >
Yarn 3.0 Performances, ESBuild, Better Patches
Support for the exports field. When using Yarn 3 w/ PnP, the exports field will be properly resolved regardless of your Node version....
Read more >
Pooya Parsa on Twitter: "Finally Berry (via nuxt-pnp), native ...
Finally Berry (via nuxt-pnp), native ESM and runtime typescript landing to ... feat: support plug-and-play, typescript runtime and nativeΒ ...
Read more >
Compatibililty with Yarn PnP (Plug and Play) feature - YouTrack
Hello JetBrains ... Any feedback about whether you're working on this ? With PNP becoming the default option in Yarn ... Supporting an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found