node.js node-modules' file path too long - node.js

I want to start learning node.js from Lynda.com "Node.js Essential Training", but I cannot extract the exercises files' "node-modules" folder for chapters 09_03 and 11_06.
I get for example this:
! C:\no\e.zip: Cannot create folder Ex_Files_Nodejs_EssT\Exercise Files\Ch11\11_06\start\node_modules\grunt-contrib-jshint\node_modules\jshint\node_modules\htmlparser2\node_modules\domutils\node_modules\dom-serializer\node_modules\entities\maps
! The filename or extension is too long.
! C:\no\e.zip: Cannot create Ex_Files_Nodejs_EssT\Exercise Files\Ch11\11_06\start\node_modules\grunt-contrib-jshint\node_modules\jshint\node_modules\htmlparser2\node_modules\domutils\node_modules\dom-serializer\node_modules\entities\maps\legacy.json
Total path and file name length must not exceed 260 characters
! The system cannot find the path specified.
How will I be able to make those exercises if I cannot extract the files?

Can you extract them without the node_modules/ folder?
You don't have to extract the installed dependencies. Instead, there should be a package.json file and then you can install them by running npm install command (from cmd or git bash terminal).
Check also that you're running version 3 of NPM (npm --version). Then all dependencies will be installed flat (not nesting node_modules/) and that won't cause your issue.

Try using a file extraction program like WinZip or 7Zip. It should allow you to redirect the extraction of certain files or folders to another location.

Related

Node on Windows error: "Source Path Too Long"

Explanation :
There are about 15 subfolders in the node_modules directory. When going to perform any operation (deleted, moved or renamed) it popup below message.
Error message:
The source file name(s) are larger than is supported by the file
system. Try moving to a location which has a shorter path name, or try
renaming to shorter name(s) before attempting this operation.
Screenshot :
sub folder inside npm_modules directory.
node_modules\gulp-connect\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-expression-parse\node_modules\spdx-license-ids\spdx-license-ids.json
Tried so far:
I also tried to delete the folder (node_modules) using command prompt using command rmdir <dirname> /S but did not work as well.
There is a way to do this is that go into subfolder after subfolder, renaming each folder to something short like 'b'. Eventually the path is short enough to allow deletion. This will waste quite a bit of time.
Is there any efficient way to delete this node_modules directory?
Newest versions of npm fix this issue flattening the path: https://github.com/npm/npm/issues/3697.
Try
D:\vms\fe> robocopy d:\path\to\temp\dir node_modules /purge
to remove the nested dirs.
Update
As pointed by Coding Professor, another option is use rimraf util (which basically calls rm -rf):
> npm install -g rimraf
> rimraf node_modules
For the record, and because of the release of a newish open-source project released by Microsoft, you can easily delete paths that are too long using WinFile (which was introduced in WinXP).
Sometimes you have to go "Back to the Future". This can delete paths too long on Microsoft networks share as well.
WinFile (compiled for Win10) available here https://github.com/Microsoft/winfile
To find many paths that are too long and automate a fix, I recommend Path Too Long Auto Fixer - a free demo is available.

dpkg-buildpackage error: missing files (usr/include/*)

I am trying to build a dev package out of some .so files - i.e libraries.
dh_make -f ../ mylibs.tar.gz
then I choose
-l
since I want a library package.
A debian folder is created which consists of among others the controlfile and the install file.
When I finally create the package with
dpkg-buildpackage
I get the following error message:
dh_install: mylibs-dev missing files (usr/include/*), aborting
I dont understand what is missing since the headers are copied to
usr/include
I have checked the directory and the headers are copied there. So why do I get this error message?
the install-file look like this:
usr/lib/lib*.so.*
So - may the path to usr/include be missing here? I've tried with
usr/include/h.*
but it does not work
The debian install files are most often used for source packages that produce several binary packages. In that case, dh_auto_install installs to the directory debian/tmp/ and dh_install moves the files from there to each package. However, when there is a single package, dh_auto_install takes a shortcut and installs directly to debian/package-name/. In that case, you only need to list in the install file the files that make install missed (usually none). If you list the regular, installed files, dh_install will get confused because it is still looking for them in debian/tmp/.
It is possible to override either the directory where dh_auto_install installs, or the directory where dh_install is looking, but you probably don't need either.

NodeJS archive manager

I need to get the content of archives and then I want to uncompress the selected one - but I dont want to uncompress the archives to know what's in it. I'd like to list and uncompress at least zip and rar, but (if that's possible) I don't want to be limited to only these two.
Can you advise good npm modules or other projects to achieve this?
Here's what I came up with:
zip
I found node-zip can only unzip files, but not list archive content.
rar
The best solution seems node-rar, but I can't install it on Windows.
node-uncompress This does what it says: It's an "Command-line wrapper for uncompressing various file types." So there is again no possibility to list archive content.
Currently I try to get node-uncompress to list files and hopefully it must never run cross-platform.
Solution:
I am now using 7zip with the node module node-7z instead of trying to get every archive working on its own. The corresponding site is: https://www.npmjs.com/package/node-7z
This library uses the OS independent archive manager 7zip. On Windows 7za is used. "7za.exe (a = alone) is a standalone version of 7-Zip". I've tested it on Windows and Ubuntu and it works great.
Update:
At Windows: Somehow I just got it working by adding 7za to the Path variables - not by adding 7za.exe to the "the same directory of your package.json file." like the description says.
Update 2:
On Windows 7za, that's referred in the node-7z post, cannot handle .rar-archives. So I'm using the "casual" 7-zip instead of 7za.exe. I just renamed the commanline 7z.exe to 7za.exe and added the 7-zip folder to the Path Variables.

where to copy samtools binary to some directories

I am installing cufflinks on my Mac OS X, and here is the instruction:
http://cufflinks.cbcb.umd.edu/tutorial.html
Under Installing the SAM tools I follow the instructions below
Download the SAM tools
Unpack the SAM tools tarball and cd to the SAM tools source directory.
Build the SAM tools by typing make at the command line.
Choose a directory into which you wish to copy the SAM tools binary, the included library libbam.a, and the library headers. A common choice is /usr/local/.
Copy libbam.a to the lib/ directory in the folder you've chosen above (e.g. /usr/local/lib/)
Create a directory called "bam" in the include/ directory (e.g. /usr/local/include/bam)
Copy the headers (files ending in .h) to the include/bam directory you've created above (e.g. /usr/local/include/bam)
Copy the samtools binary to some directory in your PATH.
I've done the fist 7 steps, but I am not sure how to proceed with the last step (#8): should I use the command:
sudo cp -a samtools-0.1.18 /usr/local/
or into some other directories? What does the PATH in step 8 indicate? Thanks!
To answer your question I will go over some basic linux knowledge that has helped me understand binaries and their locations.
In linux, you can run a binary by typing in a complete path to the binary and the binary will run. For example, if I have a binary named foo in /usr/local/bin, I would run the command /usr/local/bin/foo and the foo binary would be run.
The purpose of the PATH is a shortcut so that you don't need to type in the complete path to the binary, just the name of the binary. PATH is a variable that contains all of the directories that have binaries that you want to have the shortcut apply to. So, referring to the previous example, if /usr/local/bin is in my PATH variable, then I could just run foo.
So, to answer your question, you can tell which directories that are in your PATH by running the command echo $PATH and if one of the directories is where your samtools binaries are, your good!! If not, you can move your samtools binaries to one of those directories so that you don't have to put the full path everytime you want to run the binaries.

How to install packages in Tcl?

I am trying to install critlib on my machine (http://equi4.com/critlib/), so that I can create zip files dynamically in Tcl.
The issue is that I have no idea how to install Tcl packages. Is there a certain place you put the folders? Is there a command like yum I can use?
I've skimmed the various Tcl beginners guides and read the sections about packages, but every source always seems to be assuming knowledge I lack.
Yes, there are some directories. To list them, execute tclsh and enter
join $auto_path \n
In each of that directory and its subdir (but not the sub-sub-dir) tcl looks for a file called pkgIndex.tcl.
So if you got an archive, extract it, look where the pkgIndex.tcl is, and copy the directory where this file is in to one of the paths $auto_path. The problem is only to select the appropiate path from the output of step 1.
If you are not sure what the appropiate directory is, I suggest editing the output from the first step into your question.
If you are using vscode and made virtual environment then you can do it as follows
"pipenv install tcl"

Resources