nathankellenicki / node-poweredup

A Javascript module to interface with LEGO Powered Up components.
https://nathankellenicki.github.io/node-poweredup/
MIT License
477 stars 59 forks source link

Problem running examples on Mac OS Monteray #142

Open alin256 opened 2 years ago

alin256 commented 2 years ago

I have not run it for a while, but now on the new Mac OS (12.1) I am getting an error when running e.g.

node examples/leds.js 

Here is the error output:

node:internal/modules/cjs/loader:361
      throw err;
      ^

Error: Cannot find module '/Users/aliner/Documents/git/node-poweredup-main/node-poweredup/dist/node/index-node.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:353:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/aliner/Documents/git/node-poweredup-main/node-poweredup/examples/leds.js:7:19)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32) {
  code: 'MODULE_NOT_FOUND',
  path: 'MYPATH/git/node-poweredup-main/node-poweredup/package.json',
  requestPath: '..'

I also get an issue if I try to run examples/web_bluetooth.html It refers to ../dist/... which does not exist after the installation.

I might be missing something obvious, but readme did not answer my problems.

alin256 commented 2 years ago

After some looking into the code it seems that I should have run

npm build:all

This solves the issue above and the browser version seems to work (not every time), but this is perhaps another issue.