MylesBorins / node-osc

Open Sound Control protocol library for Node.js
GNU Lesser General Public License v3.0
435 stars 72 forks source link

Cannot properly "install" this module: Cannot find module '/home/pi/node/node_modules/node-osc/dist/lib/index.js' #54

Closed m4gh3 closed 3 years ago

m4gh3 commented 3 years ago

Hi,

I'm doing the installation of this package in a Dockerfile. This should be the relevant lines of the Dockerfile that I had: FROM debian RUN wget https://deb.nodesource.com/setup_lts.x && chmod +x setup_lts.x && bash setup_lts.x && yes | apt install nodejs && npm install -g npm@latest RUN mkdir -p /home/pi/node && cd /home/pi/node && yes | npm install socket.io-client@2.4.0 node-osc nodejs-base64

The script that is run inside the container is inside the /home/pi/node directory

However when running I get this error: Cannot find module '/home/pi/node/node_modules/node-osc/dist/lib/index.js

So after a little dig in the source of this repo I substitute the last line that I provided of Dockerfile with the following: RUN mkdir -p /home/pi/node && cd /home/pi/node && yes | npm install -g rollup && yes | npm install socket.io-client@2.4.0 node-osc nodejs-base64 && cd node_modules/node-osc && npm run-script build

And the error disappears. The issue is: it does not seem that npm install node-osc as indicated in README.md is sufficient for the module to be installed properly, or at least not ready to be used. Now I'm not an expert in nodejs I mostly work with c++. Let me know what you think and if you need any clarifications.

MylesBorins commented 3 years ago

So sorry about this! Totally missed this issue too. This should be fixed in https://github.com/MylesBorins/node-osc/pull/60

I'll get a release out asap

mattorp commented 2 years ago

When using next build (nextjs) I get a similar error. It works fine using next dev.

It's included in package.json and installed as: "node-osc": "^6.1.11"

Build outputs: Type error: Cannot find module 'node-osc' or its corresponding type declarations.

MylesBorins commented 2 years ago

@mattorp that is definitely an odd error. Can you open a new issue and include a reproduction (even just a link to a GitHub repo that has the issue would be helpful)

mattorp commented 2 years ago

@MylesBorins Don't worry about that bug. It's caused by next@10, which I had to downgrade to due to some bugs with AWS Amplify. Upgrading to next@11/12 solves the problem and next < 11.1.3 has a server crash issue: https://github.com/advisories/GHSA-25mp-g6fv-mqxx