react-native-lanscan icon indicating copy to clipboard operation
react-native-lanscan copied to clipboard

Importing module causes error: Failed to execute importScripts

Open mcintosh101 opened this issue 8 years ago • 4 comments

Hi,

I am trying to import this module into my project but the moment I add this line:

import { LANScan } from 'react-native-lanscan';

I get an error which says:

"Unable to resolve module events from /Users/amci/Sites/verv/ConnectorApp/node_modules/react-native-lanscan/main-tf.js: Module does not exist in the module map or in these directories:
/Users/amci/Sites/verv/ConnectorApp/node_modules,
/Users/amci/node_modules

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
 1. Clear watchman watches: `watchman watch-del-all`.
 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
 3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`."

I've tried everything that says, cleared all cache, removed the node_modules and re-installed them.

Do you know what is happening? I've attached a screen shot from the emulator.

screen shot 2017-01-10 at 09 43 22

mcintosh101 avatar Jan 10 '17 09:01 mcintosh101

There seems to be some sort of issue with your nodejs install. Try uninstalling it and reinstalling the latest version. Try also updating npm. The 'events' package is a core package of nodejs it shouldn't be looking for it inside your app's node_modules.

Odinvt avatar Jan 10 '17 10:01 Odinvt

Thanks for the fast reply!

I've removed Node v6.0.3 and installed Node v7.4.0. I've also updated NPM to 4.0.5.

After restarting my computer I get the exact same error.

mcintosh101 avatar Jan 10 '17 10:01 mcintosh101

As an update, I've also tried the below after the updates and restarting the computer:

./node_modules/react-native/packager/packager.sh --reset-cache

# watchman
watchman watch-del-all

# android
rm -rf android/app/build
rm -rf $HOME/.gradle/caches/
cd android/ && ./gradlew clean && cd ..

# javascript
rm -rf node_modules/
npm cache clean

# Fresh install
npm i

# clear react temp files
rm -rf $TMPDIR/react-*

But I still get the same error.

EDIT: If I remove the import statement the app functions as normal despite importing other node modules elsewhere and they work fine.

mcintosh101 avatar Jan 10 '17 11:01 mcintosh101

I have the same error

dolby360 avatar Aug 23 '19 10:08 dolby360