ionorg / ion-sdk-js

ion javascript sdk
MIT License
102 stars 69 forks source link

These relative modules were not found #235

Open flyingdove opened 2 years ago

flyingdove commented 2 years ago

On npm run serve got this:

These relative modules were not found

jason-shen commented 2 years ago

did you do a npm run install

robotpilot commented 1 year ago

I also have the same issue. So, I download and use the file directly as shown below.

$ sudo apt install subversion
$ cd ~/some_package/node_modules/ion-sdk-js/lib/
$ svn export https://github.com/pion/ion-sdk-js.git/trunk/src/_library
erroric commented 1 year ago

Workaround to automate download missed files on npm install (only Linux, without subversion install, only git binary need):

add scripts/fix_deps.sh in your project folder with content:

#!/bin/sh

set -e

cd $INIT_CWD

if [ -d ./node_modules/ion-sdk-js/lib ] && [ ! -d ./node_modules/ion-sdk-js/lib/_library ]; then
    rm -rf ion-sdk-js
    git clone https://github.com/pion/ion-sdk-js
    mv ./ion-sdk-js/src/_library ./node_modules/ion-sdk-js/lib/
    rm -rf ion-sdk-js
fi

make it executable, and then in your package.json add record in "scripts" section:

"scripts": {
    ......   
    "postinstall": "scripts/fix_deps.sh"
  },

and thats all

dalaoque commented 1 year ago
error ./node_modules/ion-sdk-js/lib/signal/grpc-web-impl.js:7:0

Module not found: Can't resolve '../_library/proto/sfu/sfu_pb_service'

image

I have reviewed the source code and found that the _library directory is just a name, but there are some steps codes in Makefile compilation:

proto: mkdir - p lib===cp rf./src/_library lib

clean: rm - rf src/_library

Deleting the _library directory caused the ESModule not to find the corresponding module when referencing files

cc: @ionorg