Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFERENCE ERROR: require is not defined #152

Open
alejandroflamerich opened this issue Mar 15, 2021 · 0 comments
Open

REFERENCE ERROR: require is not defined #152

alejandroflamerich opened this issue Mar 15, 2021 · 0 comments

Comments

@alejandroflamerich
Copy link

alejandroflamerich commented Mar 15, 2021

Node Version: 6.14.10

Node BACstack Version: 0.0.1-beta.13

Im new in BACnet protocol

Im doing the first bacnet protocol in android. IM using cordova as a tool.
Make the step as this repository sais.

1.- npm install --save bacstack (it was installed in /node_modules/bacstack folder)
2.- I added this code beloow to my index.html page.
3.- Run the app and press my button ".bacnetButton" and get the error -> require is not defined

`

> <body>
> 
> </body>
> 
> <script type="text/javascript">
>        app.initialize();
> 
> $( document ).ready(function() {
> 	$( ".bacnetButton" ).on( "click", function() {
> 	     bac();
> 	});
> });
> 
> function bac(){
> try{
>             const bacnet = require('bacstack');
>             
>             // Initialize BACStack
>             const client = new bacnet({apduTimeout: 6000});
>             
>             // Discover Devices
>             client.on('iAm', (device) => {
>               console.log('address: ', device.address);
>               console.log('deviceId: ', device.deviceId);
>               console.log('maxApdu: ', device.maxApdu);
>               console.log('segmentation: ', device.segmentation);
>               console.log('vendorId: ', device.vendorId);
>             });
>             client.whoIs();
>             
>             // Read Device Object
>             const requestArray = [{
>               objectId: {type: 8, instance: 4194303},
>               properties: [{id: 8}]
>             }];
>             client.readPropertyMultiple('192.168.1.43', requestArray, (err, value) => {
>               console.log('value: ', value);
>             });
> }catch(e){
>    console.log('error: BAC ' + e);
> }   	
> }		
> </script>

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant