Skip to content

bug: ENOENT-bug with libraries on Ionic 6  #24848

Closed

Description

@villepaananen

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

Libraries (Ionic storage, Capacitor Radar, Capacitor Community Camera Preview) don't load correctly. For Ionic Storage, ionic serve gives an error:

[react-scripts] Failed to parse source map from 'C:\Users\USER\Desktop\FOLDER\ionic-6-testing\node_modules\@ionic\storage\src\index.ts' file: Error: ENOENT: no such file or directory, open 'C:\Users\USER\Desktop\FOLDER\ionic-6-testing\node_modules\@ionic\storage\src\index.ts'

Expected Behavior

In Ionic 5 the same process doesn't produce an error and the libraries work.

Steps to Reproduce

ionic start bug-testing blank --type=ionic-react
cd bug-testing
npm install @ionic/storage

Add the following line to Home.tsx:

import { Storage } from "@ionic/storage";
const store = new Storage();

Code Reproduction URL

https://github.com/villepaananen/ionic-6-enoent-error

Ionic Info

[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module '@capacitor/ios/package'

       Require stack:
       - C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli\lib\project\index.js
       - C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli\lib\index.js
       - C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli\index.js
       - C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli\bin\ionic
[WARN] Error loading @capacitor/android package.json: Error: Cannot find module '@capacitor/android/package'

       Require stack:
       - C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli\lib\project\index.js
       - C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli\lib\index.js
       - C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli\index.js
       - C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli\bin\ionic

Ionic:

   Ionic CLI       : 6.18.1 (C:\Users\USER\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework : @ionic/react 6.0.9

Capacitor:

   Capacitor CLI      : 3.4.1
   @capacitor/android : not installed
   @capacitor/core    : 3.4.1
   @capacitor/ios     : not installed

Utility:

   cordova-res : 0.15.4
   native-run  : 1.5.0

System:

   NodeJS : v16.14.0 (C:\Program Files\nodejs\node.exe)
   npm    : 8.5.2
   OS     : Windows 10

Additional Information

No response

Activity

  1. changed the title [-]bug: [/-] [+]bug: ENOENT-bug with libraries on Ionic 6 [/+] on Feb 25, 2022
  2. self-assigned this
    on Feb 25, 2022
  3. liamdebeasi commented on Feb 25, 2022

    @liamdebeasi
    Contributor

    Thanks! I am going to move this to the @ionic/storage repository.

    The problem here is that Ionic React 6 uses react-scripts@5. This new version of react-scripts has sourcemap parsing enabled and will log a warning when no sourcemaps are found for a library. This did not happen in Ionic React 5 as that version required react-scripts@4 which did not have sourcemap parsing.

    Since this is a warning, it should not impact your ability to build/compile applications. I get the following warning on build, but the build completes successfully:

    Creating an optimized production build...
    Compiled with warnings.
    
    Failed to parse source map from '/Users/liamdebeasi/Ionic/ionic-6-enoent-error/node_modules/@ionic/storage/src/index.ts' file: Error: ENOENT: no such file or directory, open '/Users/liamdebeasi/Ionic/ionic-6-enoent-error/node_modules/@ionic/storage/src/index.ts'
    
  4. liamdebeasi commented on Feb 25, 2022

    @liamdebeasi
    Contributor

    I can't seem to transfer the issue at the moment, so I am going to close this in favor of ionic-team/ionic-storage#247. Please follow that thread for updates on this issue. Thanks!

  5. removed their assignment
    on Feb 25, 2022
  6. ionitron-bot commented on Mar 27, 2022

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  7. locked and limited conversation to collaborators on Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions