scale-it/algo-builder

Unable to install with npm or yarn: missing file/module

plasmatech8 opened this issue · 2 comments

Describe the bug

I have tried to install in an Ubuntu docker container and on my Pop-OS desktop machine.

When I try to install using npm, it gives an error 'no such file or directory' ... 'This is related to npm not being able to find a file.'.

When I try to install using yarn, it installs but on usage gives: 'Error: Cannot find module '@nodelib/fs.walk''

Expected Behavior

I expect the package to install without stating that a file or module is missing.

Current Behavior

On npm install -g @algo-builder/algob

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/local/lib/node_modules/@algo-builder/algob/node_modules/@algo-builder/runtime/build/algod.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/@algo-builder/algob/node_modules/@algo-builder/runtime/build/algod.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mark/.npm/_logs/2021-08-01T05_08_22_306Z-debug.log

On yarn global add @algo-builder/algob, and then algob:

Error: Cannot find module '@nodelib/fs.walk'
Require stack:
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/build/lib/files.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/build/lib/asa.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/build/account.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/build/index.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/algob/build/errors/errors.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/algob/build/internal/cli/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/src/lib/files.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)

Yarn installs it properly in my docker container. However, there appears to be a missing module error during usage as shown above.

Yarn isn't configured properly on my Pop-OS desktop machine, and not sure how to fix - so I haven't tried with yarn.

Possible Solution

TBA.

Steps to Reproduce

Install via npm:

docker run -it ubuntu

apt update -y
apt install wget -y

# Install node 14 with nvm
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 14

# Install algo-builder
npm install -g @algo-builder/algob -y

Result:

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /root/.nvm/versions/node/v14.17.4/lib/node_modules/@algo-builder/algob/node_modules/@algo-builder/runtime/build/algod.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/root/.nvm/versions/node/v14.17.4/lib/node_modules/@algo-builder/algob/node_modules/@algo-builder/runtime/build/algod.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-01T05_31_41_660Z-debug.log

Install via yarn:

# ...
npm install -g yarn
yarn global add @algo-builder/algob
algob

Result:

Error: Cannot find module '@nodelib/fs.walk'
Require stack:
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/build/lib/files.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/build/lib/asa.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/build/account.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/build/index.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/algob/build/errors/errors.js
- /usr/local/share/.config/yarn/global/node_modules/@algo-builder/algob/build/internal/cli/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/@algo-builder/runtime/src/lib/files.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)

Environment

  • OS: [e.g. iOS] Ubuntu 20.04.2 LTS focal x86_64 , Pop!_OS 21.04 x86_64
  • Node.js version: v14.16.1
  • algob version: - (1.1.2)

@plasmatech8 thanks for the comprehensive issue. Yes, dependencies seem to missing while doing yarn add ... Will add a fix.

BDW, installation via linking package (yarn link) should work: https://github.com/scale-it/algo-builder#installation-from-master.

New version is released which solves this issue:
https://github.com/scale-it/algo-builder/releases/tag/v1.2.0