Node.JS Org-scoped package - error when 'require()' - node.js

Context: Node.JS
I am having an error invoking 'require()' for an ORGANIZATION-SCOPED Package (from NodeJS.com)
$ pwd
/Users/Sarma
$ node
> module.paths
[ '/Users/Sarma/repl/node_modules',
'/Users/Sarma/node_modules',
'/Users/node_modules',
'/node_modules',
'/usr/local/lib/node_modules',
'/Users/Sarma/.node_modules',
'/Users/Sarma/.node_libraries',
'/usr/local/Cellar/node/10.2.1/lib/node' ]
> require('#asux.org/cli-npm')
Error: Cannot find module '#asux.org/cli-npm'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
Any Tips on how to solve this?
To investigate myself, I searched '/' for 'loader.js' and found nothing (other than under XCode and VSC).
$ pwd
/Users/Sarma
$ ls -la node_modules
total 0
drwxr-xr-x 12 Sarma staff 384 Apr 6 22:22 .
drwxr-xr-x+ 72 Sarma staff 2304 Apr 6 22:22 ..
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 .bin
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 #asux.org
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 #types
drwxr-xr-x 7 Sarma staff 224 Apr 6 22:22 ansi-styles
drwxr-xr-x 7 Sarma staff 224 Apr 6 22:22 chalk
drwxr-xr-x 9 Sarma staff 288 Apr 6 22:22 color-convert
drwxr-xr-x 6 Sarma staff 192 Apr 6 22:22 color-name
drwxr-xr-x 8 Sarma staff 256 Apr 6 22:22 commander
drwxr-xr-x 7 Sarma staff 224 Apr 6 22:22 has-flag
drwxr-xr-x 7 Sarma staff 224 Apr 6 22:22 supports-color
$ ls -la node_modules/#asux.org/cli-npm
total 32
drwxr-xr-x 8 Sarma staff 256 Apr 6 22:22 .
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 ..
-rw-r--r-- 1 Sarma staff 3834 Oct 26 1985 HISTORY
-rw-r--r-- 1 Sarma staff 1516 Oct 26 1985 LICENSE
drwxr-xr-x 5 Sarma staff 160 Apr 6 22:22 bin
drwxr-xr-x 3 Sarma staff 96 Apr 6 22:22 node_modules
-rw-r--r-- 1 Sarma staff 375 Apr 6 22:22 package-lock.json
-rw-r--r-- 1 Sarma staff 2100 Apr 6 22:22 package.json
Thanks in advance!

In package.json..
I was missing the obvious (in hindsight).
"main": "bin/asux_module.js",
Once I added it, require() was successful.

Related

Hidden Files Not Being Copied On Mac with cp -r

Very very weird issue. I have a project that has hidden files on Mac OS 12.2.1, I am try to copy over. For example:
drwxr-xr-x 16 john staff 512 Jun 25 10:35 .
drwxr-xr-x 6 john staff 192 Jun 27 06:50 ..
-rw-r--r--# 1 john staff 6148 Jun 5 13:52 .DS_Store
drwxr-xr-x 14 john staff 448 Jun 26 20:29 .git
-rw-r--r-- 1 john staff 310 Jun 4 09:52 .gitignore
-rw-r--r-- 1 john staff 368 Jun 4 10:15 Dockerfile
-rw-r--r-- 1 john staff 3486 Jun 20 15:29 README.md
drwxr-xr-x 8 john staff 256 Jun 24 16:49 build
-rw-r--r-- 1 john staff 217 Jun 4 10:16 docker-compose.yml
drwxr-xr-x 817 john staff 26144 Jun 25 14:31 node_modules
-rw-r--r-- 1 john staff 1075501 Jun 25 14:31 package-lock.json
-rw-r--r-- 1 john staff 1185 Jun 25 14:31 package.json
-rw-r--r-- 1 john staff 82 Jun 4 10:30 postcss.config.js
drwxr-xr-x 9 john staff 288 Jun 5 14:00 public
drwxr-xr-x 18 john staff 576 Jun 20 13:42 src
-rw-r--r-- 1 john staff 2836 Jun 5 02:36 tailwind.config.js
Now I run the following command
sudo cp -R * ../otherfolder
And I've also tried a variation
cp -r * ../otherfolder
And the following is there:
drwxr-xr-x 13 john staff 416 Jun 27 07:54 .
drwxr-xr-x 6 john staff 192 Jun 27 06:50 ..
-rw-r--r-- 1 john staff 368 Jun 27 07:54 Dockerfile
-rw-r--r-- 1 john staff 3486 Jun 27 07:54 README.md
drwxr-xr-x 8 john staff 256 Jun 27 07:54 build
-rw-r--r-- 1 john staff 217 Jun 27 07:54 docker-compose.yml
drwxr-xr-x 817 john staff 26144 Jun 27 07:54 node_modules
-rw-r--r-- 1 john staff 1075501 Jun 27 07:54 package-lock.json
-rw-r--r-- 1 john staff 1185 Jun 27 07:54 package.json
-rw-r--r-- 1 john staff 82 Jun 27 07:54 postcss.config.js
drwxr-xr-x 9 john staff 288 Jun 27 07:54 public
drwxr-xr-x 18 john staff 576 Jun 27 07:54 src
-rw-r--r-- 1 john staff 2836 Jun 27 07:54 tailwind.config.js
None of the invisible files with a period in front have NOT been copied over. Any ideas?
cp -rpv . /path/to/other/folder/

bash: poetry: command not found

Goal: Get Poetry working in my Anaconda3 venvs.
I'm using Anaconda3, via. Git Bash in PyCharm.
I installed Poetry using:
conda install -c conda-forge poetry
Location:
C:\Users\dabell\Anaconda3\Lib\site-packages\poetry
C:\Users\dabell\Anaconda3\Scripts\poetry.exe
$ ls -alrth
total 376K
-rw-r--r-- 3 HDS+dabell 4096 81 Mar 31 15:37 __init__.py
-rw-r--r-- 3 HDS+dabell 4096 1.4K Apr 20 06:53 poetry.py
-rw-r--r-- 3 HDS+dabell 4096 506 Apr 20 06:53 locations.py
-rw-r--r-- 3 HDS+dabell 4096 5.3K Apr 20 06:53 factory.py
-rw-r--r-- 3 HDS+dabell 4096 99 Apr 20 06:53 exceptions.py
-rw-r--r-- 3 HDS+dabell 4096 23 Apr 20 06:53 __version__.py
-rw-r--r-- 3 HDS+dabell 4096 92 Apr 20 06:53 __main__.py
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 core/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 __pycache__/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 _vendor/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 config/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 console/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 inspection/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 installation/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 io/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 json/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 layouts/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 masonry/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 mixology/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 packages/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 ./
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 publishing/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 puzzle/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 repositories/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 utils/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 version/
drwxr-xr-x 1 HDS+dabell 4096 0 Jun 16 15:30 ../
However, in (base) or in any (<venv>) - when I run:
$ poetry install pandas
bash: poetry: command not found
python -m poetry install pandas:
C:\Users\dabell\Anaconda3\envs\sdg\python.exe: No module named poetry
I added it to .bashrc, and still get the above error:
$ export PATH="$HOME/.poetry/bin:$PATH"
or
$ export PATH=C:/Users/dabell/Anaconda3/Lib/site-packages/poetry:$PATH
$ poetry install pandas
bash: poetry: command not found
$ winpty poetry install pandas
winpty: error: cannot start 'poetry': Not found in PATH
$ $HOME/.poetry/bin
bash: /c/Users/dabell/.poetry/bin: No such file or directory
HDS+dabell#PF2DCSXD MINGW64 ~/Documents/GitHub/lumada-catalog/synthetic-data-gen/sdg (daniel_sims)
$ export PATH=/C/Users/dabell/Anaconda3/Lib/site-packages/poetry:$PATH
HDS+dabell#PF2DCSXD MINGW64 ~/Documents/GitHub/lumada-catalog/synthetic-data-gen/sdg (daniel_sims)
$ poetry install pandas
bash: poetry: command not found
$ echo $PATH
/C/Users/dabell/Anaconda3/Lib/site-packages/poetry:/c/Users/dabell/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/dabell/bin:/c/Users/dabell/Anaconda3/envs/sdg:/c/Users/dabell/Anaconda3/e
nvs/sdg/Library/mingw-w64/bin:/c/Users/dabell/Anaconda3/envs/sdg/Library/usr/bin:/c/Users/dabell/Anaconda3/envs/sdg/Library/bin:/c/Users/dabell/Anaconda3/envs/sdg/Scripts:/c/Users/dabell/Anaconda3/envs/sdg/bin:/c/User
s/dabell/Anaconda3/condabin:/c/Program Files/Common Files/Oracle/Java/javapath:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/Windo
wsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/gs/gs9.56.1/bin:/c/Users/dabell/AppData/Local/Programs/Python/Python310:/usr/bin/vendor_perl:/usr/bin/core_perl

topojson command not added on npm install

I am getting an error when using topojson saying that the command cannot be found. I think the install has gone OK but there just isn't a command for topojson, but there are ones for topo2geo, topomerge etc. I'm using nvm if that is relevant and on mac.
Some Node details:
Grahams-MacBook-Air:data grahamfletcher$ ls -l /Users/grahamfletcher/.nvm/versions/node/v7.10.0/lib/node_modules/
total 0
drwxr-xr-x 3 grahamfletcher staff 102 14 Jul 22:01 #angular
drwxr-xr-x 7 grahamfletcher staff 238 10 Oct 02:58 create-react-app
drwxr-xr-x 11 grahamfletcher staff 374 14 Jul 23:35 eslint
drwxr-xr-x 18 grahamfletcher staff 612 25 Jul 01:34 nodemon
drwxr-xr-x 25 grahamfletcher staff 850 3 May 2017 npm
drwxr-xr-x 13 grahamfletcher staff 442 22 Nov 13:00 ogr2ogr
drwxr-xr-x 11 grahamfletcher staff 374 22 Nov 14:42 topojson
topojson is there, but...
Grahams-MacBook-Air:data grahamfletcher$ ls -l /Users/grahamfletcher/.nvm/versions/node/v7.10.0/bin
total 69760
lrwxr-xr-x 1 grahamfletcher staff 45 10 Oct 02:58 create-react-app -> ../lib/node_modules/create-react-app/index.js
lrwxr-xr-x 1 grahamfletcher staff 40 14 Jul 23:35 eslint -> ../lib/node_modules/eslint/bin/eslint.js
lrwxr-xr-x 1 grahamfletcher staff 70 15 Nov 11:10 geo2topo -> ../lib/node_modules/topojson/node_modules/topojson-server/bin/geo2topo
lrwxr-xr-x 1 grahamfletcher staff 39 14 Jul 22:01 ng -> ../lib/node_modules/#angular/cli/bin/ng
-rwxr-xr-x 1 grahamfletcher staff 35672760 3 May 2017 node
lrwxr-xr-x 1 grahamfletcher staff 42 25 Jul 01:34 nodemon -> ../lib/node_modules/nodemon/bin/nodemon.js
lrwxr-xr-x 1 grahamfletcher staff 38 3 May 2017 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxr-xr-x 1 grahamfletcher staff 70 15 Nov 11:10 topo2geo -> ../lib/node_modules/topojson/node_modules/topojson-client/bin/topo2geo
lrwxr-xr-x 1 grahamfletcher staff 71 15 Nov 11:10 topomerge -> ../lib/node_modules/topojson/node_modules/topojson-client/bin/topomerge
lrwxr-xr-x 1 grahamfletcher staff 74 15 Nov 11:10 topoquantize -> ../lib/node_modules/topojson/node_modules/topojson-client/bin/topoquantize
lrwxr-xr-x 1 grahamfletcher staff 76 15 Nov 11:10 toposimplify -> ../lib/node_modules/topojson/node_modules/topojson-simplify/bin/toposimplify
No topojson here??
My path, which is saying something about a valid identifier. Is this an issue?
Grahams-MacBook-Air:data grahamfletcher$ export $PATH
-bash: export: `/Library/Frameworks/GDAL.framework/Programs:/opt/local/bin:/opt/local/sbin:/Users/grahamfletcher/.nvm/versions/node/v7.10.0/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands': not a valid identifier

Finding all directories that are world readable

**I cannot use find as I get a permission denied error
I am trying to find all the directories in /students that are world readable. This is what I have so far:
grep 'r-x' | cut -c8-10 | ls -l /students | sort | uniq -c
I don't understand why this is not working. I am telling the shell to search for occurrences of 'r-x'in the 8th-10th characters of ls -l which is other users permissions (hence world readable). Then I'm sorting the output and displaying a count of matching results with uniq -c. This is my understanding of what my shell script should do and I dont see why its not. Any help would be greatly appreciated!
For some reason it's pulling out more than just the directories readable by others.
Here is some sample output (I omitted the majority of the output)
1 drwx------ 11 lluong b20107 4096 May 26 11:15 lluong
1 drwx------ 23 stretbar b20097 4096 Dec 18 2012 stretbar
1 drwx------ 2 slawson b20003 4096 Mar 2 2013 slawson
1 drwx------ 9 fcunha b20117 4096 May 2 15:21 fcunha
1 drwxrwxrwx 10 jwu131 b20117 4096 Jul 2 19:26 jwu131
1 drwxrwxrwx 14 jadler4 b20127 4096 Oct 11 2012 jadler4
1 drwxrwxrwx 5 rlicudo1 b20067 4096 Apr 3 15:28 rlicudo1
1 drwxrwxrwx 8 lkrubner b20107 4096 Oct 25 2011 lkrubner
1 drwxrwxrwx 9 klau53 b20133 4096 Mar 12 2013 klau53
1 drwxrwx--x 14 vrobins9 b20123 4096 Mar 4 2013 vrobins9
1 drwxr-xr-x 10 aguo3 b20107 4096 Sep 24 00:13 aguo3
1 drwxr-xr-x 10 mdanial b20123 4096 Apr 10 20:46 mdanial
1 drwxr-xr-x 11 49 users 4096 Mar 28 2013 trac
1 drwxr-xr-x 11 rroger12 b20133 4096 May 8 10:00 rroger12
1 drwxr-xr-x 12 spark15 b20113 4096 May 15 2012 spark15
1 drwxr-xr-x 18 lulrich1 b20133 4096 Sep 29 22:36 lulrich1
1 drwxr-xr-x 18 yliu192 b20127 4096 Sep 26 12:19 yliu192
1 drwxr-xr-x 19 dstein b20117 4096 Feb 9 2013 dstein
1 drwxr-xr-x 20 jgarc166 b20127 4096 Sep 12 19:22 jgarc166
1 drwxr-xr-x 2 root root 16384 Nov 15 2007 lost+found
1 drwxr-xr-x 4 jsarno b20113 4096 Dec 7 2011 jsarno
1 drwxr-xr-x 6 btaylo19 b20123 4096 Mar 5 2012 btaylo19
1 drwxr-xr-x 6 dtu b20093 4096 Apr 18 19:18 dtu
1 drwxr-xr-x 6 ewu2 b20133 4096 May 4 14:30 ewu2
1 drwxr-xr-x 6 smeehan b20053 4096 Aug 29 00:19 smeehan
1 drwxr-xr-x 6 ybondar2 b20027 4096 May 23 2012 ybondar2
1 drwxr-xr-x 7 apekar b20103 4096 May 10 00:22 apekar
1 drwxr-xr-x 7 root root 4096 Mar 28 2013 tracprojects
1 drwxr-xr-x 8 jhsiao b20117 4096 Jul 26 17:33 jhsiao
1 drwxr-xr-x 8 xfeng18 b20137 4096 Sep 25 14:42 xfeng18
1 drwxr-xr-x 9 cmendo26 b20133 4096 Aug 19 01:22 cmendo26
1 drwx-----x 8 amissiro b20093 4096 May 12 16:00 amissiro
1 drwx--xr-x 17 apinchuk b20127 4096 May 26 23:03 apinchuk
1 drwx--x--x 10 aboak b20093 4096 Feb 18 2013 aboak
1 drwx--x--x 10 achan123 b20133 4096 Sep 6 21:24 achan123
1 drwx--x--x 10 acurkend b20133 4096 Jul 10 13:15 acurkend
1 drwx--x--x 10 akleinii b20133 4096 Jun 21 09:07 akleinii
1 drwx--x--x 10 akobzar b20133 4096 Sep 26 18:51 akobzar
1 drwx--x--x 10 amainett b20137 4096 Sep 22 11:17 amainett
1 drwx--x--x 10 apewther b20127 4096 Feb 6 2013 apewther
1 drwx--x--x 10 asyrtsov b20127 4096 Aug 16 10:43 asyrtsov
1 drwx--x--x 10 bernst b20135 4096 Sep 23 09:12 bernst
1 drwx--x--x 10 blilley b20123 4096 Apr 20 18:08 blilley
1 drwx--x--x 10 bmckeand b20117 4096 Aug 14 14:17 bmckeand
1 drwx--x--x 10 bsmith18 b20097 4096 Jun 10 11:19 bsmith18
1 drwx--x--x 10 bwilli18 b20117 4096 Nov 6 2012 bwilli18
1 drwx--x--x 10 cbeaton b20123 4096 May 19 04:07 cbeaton
1 drwx--x--x 10 cbeck4 b20137 4096 Sep 29 16:08 cbeck4
1 drwx--x--x 10 cho8 b20093 4096 Mar 24 2013 cho8
1 drwx--x--x 10 cliu58 b20117 4096 Oct 8 2012 cliu58
1 drwx--x--x 10 cmitch21 b20133 4096 Mar 10 2013 cmitch21
1 drwx--x--x 10 cnavarr9 b20127 4096 Apr 30 12:11 cnavarr9
1 drwx--x--x 10 dbienenf b20123 4096 Mar 20 2012 dbienenf
1 drwx--x--x 10 dlau13 b20135 4096 Jul 16 12:15 dlau13
1 drwx--x--x 10 dmok1 b20137 4096 Sep 24 12:50 dmok1
1 drwx--x--x 10 dnou b20133 4096 Apr 23 14:12 dnou
1 drwx--x--x 10 drajabar b20137 4096 Sep 3 20:20 drajabar
1 drwx--x--x 10 drodri12 b20115 4096 Sep 27 17:25 drodri12
1 drwx--x--x 10 ealberto b20113 4096 Dec 18 2012 ealberto
Rather than parsing ls, use find:
find /students -perm -o=r
This would list all files and directories in /students that are world readable.
If you don't want to recurse into subdirectories and want to find only directories, say:
find /students -maxdepth 1 -type d -perm -o=r
I am telling the shell to search for occurrences of 'r-x'in the 8th-10th characters of ls -l which is other users permissions (hence world readable).
No you're not. You're looking for "r-x" anywhere in the line and then taking the 8th through 10th characters of the lines found.
find /students -mindepth 1 -maxdepth 1 -type d -perm -005 | ...
"Why you shouldn't parse the output of ls(1)"
ls -lad */ | grep 'r-x' | sort | uniq -c
-d is used to list ONLY directories.
*/ tells *nix to search ONLY the current directory.
ls -lR |grep "^d" | cut -c8-10 | grep 'r-x' | sort | uniq -c

Quit hidden attribute to many files in a directory once in UNIX

Hello Everybody there.
I wanna know if there is a command of set of commands (maybe a pipeline set) which can be used to change the hidden attribute of many files stored in a particular directory, with the same name.
ie.
ls -la inside torrents/music/david_guetta_greatest_hits shows the next files:
drwxrwxrwx 20 crsuarez staff 680 Apr 9 19:25 .
drwxrwxrwx 20 crsuarez staff 680 Apr 9 19:11 ..
-rw-r--r-- 1 crsuarez staff 6894561 Apr 9 19:16 .I'm Famous.wma
-rw-r--r-- 1 crsuarez staff 7543777 Apr 9 19:16 .Gettin Over.wma
-rw-r--r-- 1 crsuarez staff 6378465 Apr 9 19:16 .I Gotta Feeling.wma
-rw-r--r-- 1 crsuarez staff 7245793 Apr 9 19:16 .In love with myself.wma
-rw-r--r-- 1 crsuarez staff 7060449 Apr 9 19:16 .It's the Way You Love Me.wma
-rw-r--r-- 1 crsuarez staff 7737313 Apr 9 19:16 .Love Don't Let Me Go.wma
-rw-r--r-- 1 crsuarez staff 7737313 Apr 9 19:16 .Love is Gone.wma
-rw-r--r-- 1 crsuarez staff 6628321 Apr 9 19:16 .Memories.wma
-rw-r--r-- 1 crsuarez staff 7525345 Apr 9 19:16 .Money.wma
-rw-r--r-- 1 crsuarez staff 7806945 Apr 9 19:16 .One Love.wma
-rw-r--r-- 1 crsuarez staff 7192545 Apr 9 19:16 .Sexy Bitch.wma
-rw-r--r-- 1 crsuarez staff 6954977 Apr 9 19:16 .Stay.wma
-rw-r--r-- 1 crsuarez staff 8025057 Apr 9 19:16 .The World is Mine.wma
-rw-r--r-- 1 crsuarez staff 7769057 Apr 9 19:16 .TitaniuM.wma
-rw-r--r-- 1 crsuarez staff 6693857 Apr 9 19:16 .Turn ME ON.wma
-rw-r--r-- 1 crsuarez staff 7215073 Apr 9 19:16 .When Love Takes Over.wma
-rw-r--r-- 1 crsuarez staff 8182753 Apr 9 19:16 .Without YoU.wma
I wanna unhide all of this files with a single set of commands (I don't care if I have to use pipeline), instead of use mv .hidden_file_name not_hidden_file_name.
The solution must be OSX Complain. ;)
Something like this
for origname in .[0-9A-Za-z]*
do
if [ -f "${origname}" ]; then
# compute your newname how you want it
mv "${origname}" "${newname}
fi
done
You'll have to decide what you want your new names to be - you'll strip off the leading dot '.' but doing only what will probably collide with an existing .wma file with the same name, so maybe also append .tmp -- like:
.One Love.wma --becomes--> One Love.wma.tmp
Use prename (rename on Debian-derived systems).
prename 's/^.//' .*.wma

Resources