Ionic 2 unmanageble directory structure

Hi Gnout,
I have Windows 10 and I’ve never seen this issue in my computer or ionic workspace. I also keep up-to-date versions of all required software. However, I will admit I haven’t used ionic in like two months due to learning Game Development.

I’m sure you’ll find a workaround.

Regards,
Edwin B.
Neonic, Inc. CEO

I was having these problems with Windows and long file names etc however installing the latest npm fixed the issue because version 3 onwards I believe (and as Mike Hartington has also commented) creates a flat dependency tree structure for node modules.

Regardless if you have a recent version of Node, do this:

npm install -g npm

Note that npm is updated more frequently than Node, so the latest Node version may not necessarily have the latest npm version.

The latest npm version at the time of writing is 3.8.8.

1 Like

Finally! It worked! Funny thing is that I didn’t do anything different
node version: 6.0.0
npm version: 3.8.7
I executed the commands
ionic start myapp –v2
cd myapp
ionic serve
and I got the application running on Chrome! No errors!
The node_modules directory contains 505 directories! Is that normal?
Thank you for the support.
By the way, any news for Ionic 2 Visual Studio Templates?
There is a great VS template for Ionic 1, are you planning to have something similar for Ionic 2?

I ran into similar issues with my ionic projects and I resolved all of them with the Windows built-in RoboCopy (“Robust File Copy”) program.

First, to delete a folder with long path names, create a batch files with these contents (say it’s called delfolder.bat):

@echo off
REM from here: http://kb.ischool.uw.edu/use-robocopy-to-delete-filesfolders-with-long-filenames/
if {%1}=={} @echo Syntax: DelFolder FolderPath&goto :EOF
if not exist %1 @echo Syntax: DelFolder FolderPath – %1 NOT found.&goto :EOF
setlocal
set folder=%1
set MT=“%TEMP%\DelFolder_%RANDOM%”
MD %MT%
RoboCopy %MT% %folder% /MIR
RD /S /Q %MT%
RD /S /Q %folder%
endlocal

and then run

delfolder [your-folder-name]

RoboCopy can also be used to copy folders with long pathnames(just like XCOPY); I recommend you review all its options.

I struggled with this too. I found out that 7-zip does delete a long file structure :sunglasses:. No hassle with scripts.

Using the latest version of npm for future projects should prevent the need for any external software or scripts to copy/move/delete such projects. See my previous post.

Hi, I just ran into the same problem. I wanted to copy my project folder and then it said,that the file names are too long. Never have seen this before.
I updated node and npm nad also installed a new ionic project, but the error is still there.
Are there any other ideas how to manage this?

Thank you!

node: 6.9.1
npm: 3.10.9

Hi Basti
There is a new Template package for Visual Studio 2015 and Ionic 2. You can find it here.
I used it and it worked fine for me. Try it, maybe this will solve your problem.
It produce a huge project (~200MB)

D:\REPO_XXXXXXXX\test\android\node_modules\gulp-sass\node_modules\node-sass\node_modules\sass-graph\node_modules\yargs\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\parse-json\node_modules\error-ex\node_modules

Ionic v2.2.1
NPM v2.15.1

Suggestions to use Cygwin and other tools are work-arounds and not a structural solution. Its a big pain to delete a project! Is this being looked at?

Regards,

SG