React-native-vector-icons: Unable to resolve module `./lib/create-icon-set`

Created on 3 Oct 2018  路  6Comments  路  Source: oblador/react-native-vector-icons

Environment

OS: Android 8.0
RN - 0.57.1
react-native-vector-icons - 6.0.0

Description

Unable to resolve module `./lib/create-icon-set` from `/Users/carlos/Documents/work/mobile/node_modules/react-native-vector-icons/dist/index.js`: 
The module `./lib/create-icon-set` could not be found from `/Users/carlos/Documents/work/mobile/node_modules/react-native-vector-icons/dist/index.js`. 

Indeed, none of these files exist:
  * `/Users/carlos/Documents/work/mobile/node_modules/react-native-vector-icons/dist/lib/create-icon-set(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
  * `/Users/carlos/Documents/work/mobile/node_modules/react-native-vector-icons/dist/lib/create-icon-set/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`

This was working in a previous version of RN (0.52), but since the latest update I'm getting this error.

This is the code that's causing the issue:

import { createIconSet } from 'react-native-vector-icons';
import glyphMap from './icons/selection.json';

const iconSet = createIconSet(glyphMap, 'pp-font', 'pp-font.ttf');
export default iconSet;

Most helpful comment

I am using 6.6.0 and I am seeing the issue.

All 6 comments

Until an appropriate PR is made, you can copy/symlink the lib directory into dist/.

Ended up adding a postinstall script to my package.json that copies the lib folder into dist like @dlferro suggested, also tried symlinks but those don't seem to work well with the bundler.

In case anyone is interested in the script:
"postinstall": "cd node_modules/react-native-vector-icons/dist && cp -r ../lib ./lib"

Sorry about this! Should be fixed in 6.0.1

I am using 6.6.0 and I am seeing the issue.

Same here, seeing the issue on version 6.6.0

deleting node modules and reinstalling works for me.

Was this page helpful?
0 / 5 - 0 ratings