Giter VIP home page Giter VIP logo

Comments (6)

fabioriva avatar fabioriva commented on September 21, 2024

Hello. I'm trying to get data from an S7 PLC using your library. As a result, I get the following errors: import {S7Client} from 'napi-snap7'; - "Cannot resolve symbol 'S7Client'", const res = client.ConnectTo("192.168.172.2", 0, 1); - "Unresolved function or method ConnectTo()", client.ReadArea(0x84, 42, 0, 4, 0x02, (err, data) - "Unresolved function or method ReadArea()", if (err) return console.log(client.ErrorText(err)); - "Unresolved function or method ErrorText()" and so on. What could be the reason?

Hi
This is a CommonJS module system, import statements are used in ES6 or ECMAScript module system to include modules. Therefore you must import the module using require as shown in the examples folder.

from napi-snap7.

Student3117 avatar Student3117 commented on September 21, 2024

This is what I did initially. But the result is the same:
const snap7 = require('napi-snap7'); - TS80001: File is a CommonJS module; it may be converted to an ES module.
const client = new snap7.S7Client(); - Unresolved type S7Client

from napi-snap7.

fabioriva avatar fabioriva commented on September 21, 2024

This is what I did initially. But the result is the same: const snap7 = require('napi-snap7'); - TS80001: File is a CommonJS module; it may be converted to an ES module. const client = new snap7.S7Client(); - Unresolved type S7Client

I ran the code you can find in the async_S7.js file and it works fine. I did it on my laptop running the ubuntu 22.04 OS, node v20.9.0 installed on it.

Which OS are you using?

@Sinclair81 can you help?

from napi-snap7.

Student3117 avatar Student3117 commented on September 21, 2024

I using OS Ubuntu 22.04, node v20.5.1

from napi-snap7.

Sinclair81 avatar Sinclair81 commented on September 21, 2024

Do you have napi-snap7 installed in your project folder?
npm install napi-snap7

from napi-snap7.

Student3117 avatar Student3117 commented on September 21, 2024

Of course. Project folder package.json:

"dependencies": {
    "napi-snap7": "^1.2.3",
    "prebuildify": "^5.0.1"
  }

from napi-snap7.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.