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

NPM module cannot be imported #2

Open
scranen opened this issue Apr 26, 2020 · 4 comments
Open

NPM module cannot be imported #2

scranen opened this issue Apr 26, 2020 · 4 comments

Comments

@scranen
Copy link

scranen commented Apr 26, 2020

Out of the box, loading the module does not seem to work for me.

Steps to reproduce

$ npm init -y && tsc --init
[...]
$ npm i opcua
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
added 1 package from 1 contributor and audited 1 package in 0.987s
found 0 vulnerabilities
$ ts-node
> import Client from "opcua"

Expected result
The import statement should succeed.

Actual result

$ ts-node
> import Client from "opcua"
[eval].ts:1:20 - error TS2306: File '(project-dir)/node_modules/opcua/index.d.ts' is not a module.

1 import Client from "opcua"
                     ~~~~~~~

Further information

$ npm --version
6.14.4
$ tsc --version
Version 3.8.3
$ npm ls opcua
[email protected] (project-dir)
└── [email protected] 
@zemirco
Copy link
Contributor

zemirco commented Apr 27, 2020

Hey scranen,

thank you for this detailed issues description. I certainly need to work on the published version. I had to publish a version 1.0.0 quite early because I was given the name 'opcua' on npm. Someone else had the name but didn't use it and didn't have any code behind it. However after they've given me the name I had to release a new major version that includes at least some code from my repo. So that's about the history of this project on npm. The published version is certainly out of date. However I'm not yet ready to release a next version.

If you want to play with opcua it's probably the best to have a look the demo https://github.com/HBM/opcua/tree/master/demo. Clone the repo and then create your test project inside the demo folder. Some tsconfig.json and webpack.config.js are already there.

I'm curious, what are you using as the server?

Best regards,
Mirco

@scranen
Copy link
Author

scranen commented Apr 29, 2020

Thanks for the pointers, I'll have a look. The server I'm talking to is probably an old version of the one that's integrated in Codesys (didn't really look into it, I'm doing a quick and dirty PoC on a badly documented device), using my own solution to convert it to websocket.

@mbrohard
Copy link

Hello,
I'm looking to develop a mobile application via Ionic and Angular that implements your OPC-UA library. I have the same problem as @scranen :
[ng] src/app/home/home/home.page.ts:10:20 - error TS2307: Cannot find module 'opcua'.
[ng] 10 import Client from 'opcua';

Do you have a solution for me? Thank you and have a nice day.

@vahidke
Copy link

vahidke commented Oct 11, 2021

Hi,
I still got this error. did you update the npm?

This dependency was not found:                                                                                                                                                                                                                                                                                                              
* opcua in ./node_modules/babel-loader/lib??ref--12-0!./node_modules/ts-loader??ref--12-1!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/unplugin/dist/webpack/loaders/transform.js??ref--14-0!./pages/auth/sign-up/index.vue?vue&type=script&lang=ts&

*/node_modules/opcua/index.d.ts' is not a module.

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

4 participants