TestyTs
TestyTs copied to clipboard
testyts command not on the path despite a seemingly successful installation
OS: ubuntu 20.04 LTS npm: 7.11.1
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ npm i testyts --save-dev
added 24 packages, and audited 144 packages in 5s
15 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ npm ll
[email protected]
│ /mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw
│ Backend drawing of SVG files (experimental)
├── @svgdotjs/[email protected]
│
├── @types/[email protected]
│
├── [email protected]
│
├── [email protected]
│
├── [email protected]
│
└── [email protected]
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ testyts init
testyts: command not found
Global install does not work any better :-(.
Package is well present under node_modules. What can be wrong?
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ ls -ld node_modules/test*
drwxrwxr-x 1 alain alain 110 mai 18 22:28 node_modules/testyts
Further analysis: testyts is well present in ./node_modules/.bin with a correct link. The link points to the correct js file but this file refuses to execute. (NOTE: my current Ubuntu install is fairly recent - a few weeks - and I had to install it from scratch. The system is therefore in a fairly "pristine" state regarding installed packages but the Nodejs ecosystem is present and working). bin directory is on the PATH and other commands are working.
Console activity (terminal, outside of VS Code) :
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ ls -l node_modules/.bin/
total 68
lrwxrwxrwx 1 alain alain 18 mai 3 07:59 acorn -> ../acorn/bin/acorn
lrwxrwxrwx 1 alain alain 18 mai 3 07:59 brfs -> ../brfs/bin/cmd.js
lrwxrwxrwx 1 alain alain 29 mai 3 07:59 escodegen -> ../escodegen/bin/escodegen.js
lrwxrwxrwx 1 alain alain 30 mai 3 07:59 esgenerate -> ../escodegen/bin/esgenerate.js
lrwxrwxrwx 1 alain alain 25 mai 3 07:59 esparse -> ../esprima/bin/esparse.js
lrwxrwxrwx 1 alain alain 28 mai 3 07:59 esvalidate -> ../esprima/bin/esvalidate.js
lrwxrwxrwx 1 alain alain 31 mai 3 07:59 image-size -> ../image-size/bin/image-size.js
lrwxrwxrwx 1 alain alain 19 mai 18 22:28 json5 -> ../json5/lib/cli.js
lrwxrwxrwx 1 alain alain 20 mai 18 22:28 mkdirp -> ../mkdirp/bin/cmd.js
lrwxrwxrwx 1 alain alain 26 mai 3 07:59 quote-stream -> ../quote-stream/bin/cmd.js
lrwxrwxrwx 1 alain alain 25 mai 18 22:28 testyts -> ../testyts/build/testy.js
lrwxrwxrwx 1 alain alain 21 mai 1 22:49 tsc -> ../typescript/bin/tsc
lrwxrwxrwx 1 alain alain 22 mai 1 22:49 ts-node -> ../ts-node/dist/bin.js
lrwxrwxrwx 1 alain alain 29 mai 1 22:49 ts-node-script -> ../ts-node/dist/bin-script.js
lrwxrwxrwx 1 alain alain 32 mai 1 22:49 ts-node-transpile-only -> ../ts-node/dist/bin-transpile.js
lrwxrwxrwx 1 alain alain 40 mai 1 22:49 ts-script -> ../ts-node/dist/bin-script-deprecated.js
lrwxrwxrwx 1 alain alain 26 mai 1 22:49 tsserver -> ../typescript/bin/tsserver
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ ls -l node_modules/.bin/testyts
lrwxrwxrwx 1 alain alain 25 mai 18 22:28 node_modules/.bin/testyts -> ../testyts/build/testy.js
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ ls -l node_modules/testyts/build/testy.
testy.d.ts testy.js
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ ls -l node_modules/testyts/build/testy.js
-rwxrwxr-x 1 alain alain 821 oct 26 1985 node_modules/testyts/build/testy.js
Problem seem to come from virtual node environments. The bin directory on the path is not the project's one but one from nvm:
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ which tsc
/media/elrond_2tb/Alain_home2/.nvm/versions/node/v12.16.2/bin/tsc
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ echo $PATH
/usr/local/pgsql/bin:/media/elrond_2tb/Alain_home2/.nvm/versions/node/v12.16.2/bin:/usr/local/heroku/bin:/home/alain/bin:/opt/sbt/bin:/opt/apache-maven-3.3.9/bin:/opt/minishift:/usr/share/go/bin:/opt/apache-maven-3.3.9/bin:/opt/QCad:/home/alain/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Still puzzled. With -g, testyts has well been installed:
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ npm -g ll
/media/elrond_2tb/Alain_home2/.nvm/versions/node/v12.16.2/lib/node_modules/node/lib
│
├── [email protected]
│ a package manager for JavaScript
└── [email protected]
Modern test framework for TypeScript.
... but it is not linked in .bin/
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ ls -l /media/elrond_2tb/Alain_home2/.nvm/versions/node/v12.16.2/bin/
total 0
lrwxrwxrwx 1 alain alain 55 sep 17 2020 compodoc -> ../lib/node_modules/@compodoc/compodoc/bin/index-cli.js
lrwxrwxrwx 1 alain alain 54 nov 10 2020 css-beautify -> ../lib/node_modules/js-beautify/js/bin/css-beautify.js
lrwxrwxrwx 1 alain alain 55 nov 10 2020 html-beautify -> ../lib/node_modules/js-beautify/js/bin/html-beautify.js
lrwxrwxrwx 1 alain alain 53 nov 10 2020 js-beautify -> ../lib/node_modules/js-beautify/js/bin/js-beautify.js
lrwxrwxrwx 1 alain alain 37 mai 3 07:41 jshint -> ../lib/node_modules/jshint/bin/jshint
lrwxrwxrwx 1 alain alain 39 avr 8 2020 ng -> ../lib/node_modules/@angular/cli/bin/ng
lrwxrwxrwx 1 alain alain 50 sep 17 2020 ngd -> ../lib/node_modules/@compodoc/ngd-cli/bin/index.js
lrwxrwxrwx 1 alain alain 33 mai 3 07:46 node -> ../lib/node_modules/node/bin/node
lrwxrwxrwx 1 alain alain 38 avr 26 17:31 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxrwxrwx 1 alain alain 38 avr 26 17:31 npx -> ../lib/node_modules/npm/bin/npx-cli.js
lrwxrwxrwx 1 alain alain 42 mar 21 18:05 rollup -> ../lib/node_modules/rollup/dist/bin/rollup
lrwxrwxrwx 1 alain alain 38 mai 2 20:19 tsc -> ../lib/node_modules/typescript/bin/tsc
lrwxrwxrwx 1 alain alain 43 mai 2 20:19 tsserver -> ../lib/node_modules/typescript/bin/tsserver
Nor is it present in the ../lib subtree:
alain@aegnor:~/devel_syno/NodeJS/svg-be-draw$ ls -l /media/elrond_2tb/Alain_home2/.nvm/versions/node/v12.16.2/lib/node_modules/
total 40
lrwxrwxrwx 1 alain alain 41 déc 27 20:03 alcots-lib -> /media/elrond_2tb/devel/ts-own/alcots-lib
drwxr-xr-x 3 alain alain 4096 avr 8 2020 @angular
drwxr-xr-x 4 alain alain 4096 sep 17 2020 @compodoc
drwxr-xr-x 4 alain alain 4096 nov 10 2020 js-beautify
drwxrwxr-x 7 alain alain 4096 mai 3 07:41 jshint
lrwxrwxrwx 1 alain alain 64 avr 19 2020 koala-ng9-lib -> /media/elrond_2tb/devel/angular/koala-ng9-lib/dist/koala-ng9-lib
lrwxrwxrwx 1 alain alain 60 avr 19 2020 ng-alco-lib -> /media/elrond_2tb/devel/angular/ng-alco-lib/dist/ng-alco-lib
drwxrwxr-x 5 alain alain 4096 mai 4 06:38 node
drwxrwxr-x 7 alain alain 4096 avr 26 17:31 npm
drwxrwxr-x 4 alain alain 4096 mar 21 18:05 rollup
drwxrwxr-x 5 alain alain 4096 mai 2 20:19 typescript
Linking from .../nvm/... to the executable does not solve the problem :
alain@aegnor:/mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw$ ls -l /mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw/node_modules/.bin
total 68
lrwxrwxrwx 1 alain alain 18 mai 3 07:59 acorn -> ../acorn/bin/acorn
lrwxrwxrwx 1 alain alain 18 mai 3 07:59 brfs -> ../brfs/bin/cmd.js
lrwxrwxrwx 1 alain alain 29 mai 3 07:59 escodegen -> ../escodegen/bin/escodegen.js
lrwxrwxrwx 1 alain alain 30 mai 3 07:59 esgenerate -> ../escodegen/bin/esgenerate.js
lrwxrwxrwx 1 alain alain 25 mai 3 07:59 esparse -> ../esprima/bin/esparse.js
lrwxrwxrwx 1 alain alain 28 mai 3 07:59 esvalidate -> ../esprima/bin/esvalidate.js
lrwxrwxrwx 1 alain alain 31 mai 3 07:59 image-size -> ../image-size/bin/image-size.js
lrwxrwxrwx 1 alain alain 19 mai 19 07:57 json5 -> ../json5/lib/cli.js
lrwxrwxrwx 1 alain alain 20 mai 19 07:57 mkdirp -> ../mkdirp/bin/cmd.js
lrwxrwxrwx 1 alain alain 26 mai 3 07:59 quote-stream -> ../quote-stream/bin/cmd.js
lrwxrwxrwx 1 alain alain 25 mai 19 07:57 testyts -> ../testyts/build/testy.js
lrwxrwxrwx 1 alain alain 21 mai 1 22:49 tsc -> ../typescript/bin/tsc
lrwxrwxrwx 1 alain alain 22 mai 1 22:49 ts-node -> ../ts-node/dist/bin.js
lrwxrwxrwx 1 alain alain 29 mai 1 22:49 ts-node-script -> ../ts-node/dist/bin-script.js
lrwxrwxrwx 1 alain alain 32 mai 1 22:49 ts-node-transpile-only -> ../ts-node/dist/bin-transpile.js
lrwxrwxrwx 1 alain alain 40 mai 1 22:49 ts-script -> ../ts-node/dist/bin-script-deprecated.js
lrwxrwxrwx 1 alain alain 26 mai 1 22:49 tsserver -> ../typescript/bin/tsserver
alain@aegnor:/mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw$ ls -l /mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw/node_modules/.bin/../testyts/build/
total 16
drwxrwxr-x 1 alain alain 232 mai 19 07:57 lib
-rw-rw-r-- 1 alain alain 820 oct 26 1985 testyCore.d.ts
-rw-rw-r-- 1 alain alain 2129 oct 26 1985 testyCore.js
-rw-rw-r-- 1 alain alain 47 oct 26 1985 testy.d.ts
-rwxrwxr-x 1 alain alain 821 oct 26 1985 testy.js
alain@aegnor:/mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw$
alain@aegnor:/mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw$ testyts init
bash: /mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw/node_modules/.bin/testyts: Permission denied
Executing the command as root does not help:
root@aegnor:/mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw# /mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw/node_modules/.bin/testyts init
bash: /mnt/ubuntu18.04/home/alain/devel_syno/NodeJS/svg-be-draw/node_modules/.bin/testyts: Permission denied
Installation problem (namely that testyts does not appear anywhere on the PATH remains unsolved (and I don't exactly know how to solve it) but I have a workaround consisting in directly invoking testy.js under node_modules. :-( For now, I will proceed so, in order to evaluate TestyTs. If successful, I can contemplate contributing to Testy by fixing this installation problem. Any hint welcome.
Hi! Sorry I haven't had time to look into that yet, thanks for the detail level though, I appreciate! I'll try and look into that as soon as possible.
Another workaround would be to install testy
locally and invoke it through your package.json
. This is the method I'd recommend. Let me know if this works!
Yes, defining "test" under "scripts" as "node node_modules/testyts/build/testy.js" works as a workaround.
I remain interested in a more permanent fix, of course ;-)
Yes, defining "test" under "scripts" as "node node_modules/testyts/build/testy.js" works as a workaround.
Have you tried invoking testy
from your test script instead of node_modules/testyts/build/testy.js
? It should yield the same result; the build/testy.js
file is defined as the package entrypoint. Unless there are some package resolution shenanigans happening that I am not aware of, I am pretty confident it should work. 🤨 If you have the chance to try it, let me know if it works :)