Comments (6)
Hey nelson,
i now from webpack how this works. but no xp with browserfy.
On Webpack you need to define modules which contains "native node modules" as external dependency.
e.g.
externals: {
"wiringpi-node": "require('wiringpi-node')"
}
Native node modules are written in C or C++ ...
means you can't bundle it, you have to copy the dependency to your build target.
regards
Tristan
from mfrc522-rpi.
Thankyou...
As you said, i bundled the file using webpack.
But the output file contains a require statement for wiringpi-node as below.
(function(module, exports) {
module.exports = require("wiringpi-node");
})
My aim is to make MFRC based login system from the client side and for that, I want to read cards from client side browser using the above bundled js file
Since the bundled file contains a require statement for the wiring-pi node, browser shows the following error in console
Uncaught Error: Module name "wiringpi-node" has not been loaded yet for context: _. Use require([])
Is there any option to include wiring-pi node to java-script running on the browser.
Thanks for your help
from mfrc522-rpi.
In the browser its not possible but in an electron app.
clone https://github.com/electron/electron-quick-start
- change webpack "target" to electron-renderer
- in package.json of electron-quick-start point "main" to your bundle.
- external module (wiring-pi) needs to be installed/copied in electron-quick-start.
from mfrc522-rpi.
I have the same issue but i'm not trying to bundle anything, just doing node test/read.js
and it throw me this error :
Error: Cannot find module '../build/Release/WiringPi'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/pi/project/node_modules/wiringpi-node/lib/exports.js:1:80)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
Node v9.10.1
Linux raspberrypi 4.1.18-v7+
EDIT : using node v8.9.4 solved my wiringpi installation problem, i then used wiringpi-node instead of wiring-pi (because of a hardware error) and everything worked fine
from mfrc522-rpi.
@PierreTrp have you installed deps ? npm install
from mfrc522-rpi.
I'm seeing this same thing, not bundling anything and have done nom install wiring-pi.
from mfrc522-rpi.
Related Issues (17)
- Unable to determine hardware version. I see: Hardware : BCM2835 HOT 9
- MFRC522 not working on RPi 4 HOT 5
- Increasing range of MFRC522 HOT 2
- MFRC522-python not working after running mfrc522-rpi HOT 1
- Very long delay on startup: Reason for 250ms delay? HOT 10
- 7 byte uid HOT 1
- Cannot get continuous read HOT 5
- Atomics.wait cannot be called in this context HOT 12
- Pin in use
- Request for publishing the package in npm
- Race condition(?) on a mifare ISO/IEC 14443-4 card
- Request for publishing the repo in npm
- Error while reading! Status: false Data: 55 BitSize: 0
- Use SPI1 HOT 8
- Example of how to write on NTAG213, if possible HOT 3
- LEDs on module HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mfrc522-rpi.