Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies in bundledDependencies cause Windows too long path error. #2146

Closed
rmaziarka opened this issue Jan 12, 2016 · 9 comments
Closed

Comments

@rmaziarka
Copy link

Hi guys,

We have the same error like @Herby had here: #1948

Packing all dependencies in bundleDependencies in package.json creates path that exceeds maximum path length in Windows system:

C:\Users\rmaziarka\Documents\Projects\ProjectName\src\wwwroot\node_modules\bower\node_modules\update-notifier\node_modules\latest-version\node_modules\package-json\node_modules\got\node_modules\duplexify\node_modules\end-of-stream\node_modules\once\node_modules\wrappy\test

273 letters. This is working properly in version 1.6.6, before 1.6.7 - Bundless all the dependencies again https://github.com/bower/bower/blob/master/CHANGELOG.md happened.

@kasajian
Copy link

I have some additional information that I hope will help, and may have a proposal for a simple fix.

I have project and have the following dependencies in my package.json:
"bower": "1.7.2",
"del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-foreach": "^0.1.0",
"gulp-plumber": "^1.0.1",
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^1.6.0",
"gulp-typescript": "^2.10.0",
"gulp-uglify": "^1.5.1",
"gulp-util": "^3.0.7",
"typescript": "^1.7.5"

The root of my source code is:
c:\s\Server

If I look at the paths under node_module, the longest path I get is:
c:\s\Server\node_modules\bower\node_modules\update-notifier\node_modules\latest-version\node_modules\package-json\node_modules\got\node_modules\read-all-stream\node_modules\readable-stream\node_modules\process-nextick-args\package.json

which is 235 characters.

My colleague at work stores his source at:
C:/Users/xyxyxyx/Source/Repos/xxxxyyyyy/

which pushes it over the limit.

As a test, if I delete the node_modules\bower tree on my computer, then the next longest line becomes:

C:\s\Server\node_modules\gulp-typescript\node_modules\glob-stream\node_modules\readable-stream\lib_stream_passthrough.js

which is only 121 characters.

We're using "npm 3", which uses flat dependencies, rather than nesting node_modules folders within node_modules folders. I was surprised to see bower nave node_modules nested the 'npm 2' way.

I suspect the reason is because of bundleDependencies

If you look at the package.json file in bower, it has:

"_npmVersion": "2.14.15"

which means the version of bower that we're using, the current version as of now, "1.7.2", is using npm 2 somewhere in the build pipe. And, by definition, the packager bundles the node_modules as is.

When we do an 'npm install' on our system with npm 3, it's rare to see node_modules nested. It does happen sometimes, when there's modules refer to different versions of a common module, but the paths never get that long. As you can see, in the extreme case, such as with typescript, the longest length is 121 characters.

When I do this in the node_modules folder:

grep -ir --include=package.json bundleDependencies *

I notice that bower is the only component that uses this feature.

My suggestion is to upgrade to npm 3 or to no use bundleDependencies.


I used the following windows script to determine the longest line:
cd node_modules
dir /s/b >x.txt
powershell
$longest = 0; foreach ($LINE in $(gc x.txt)) {if ($longest -lt $LINE.Length) {$longest = $LINE.Length; $w = $LINE}}; $longest; $w

@AdamPflug
Copy link

This prevents deployment of apps using bower on Azure :( Agree that using bundleDependencies when the paths are that deep is probably wrong.

@rmaziarka
Copy link
Author

My suggestion is to upgrade to npm 3...

I have node 3.5.3, so the problem is in bundleDependencies.

@AdamPflug
Copy link

I think he meant to bundle dependencies with npm v3.0 so that the resulting structure was flat. That would probably require npm 3.0 for users though...

@sheerun
Copy link
Contributor

sheerun commented Jan 26, 2016

@AdamPflug I made preview of bower bundled this way. Could you test it?

npm install -g bower-prerelease@1.7.7

@sheerun
Copy link
Contributor

sheerun commented Jan 26, 2016

It should be fixed in bower 1.7.5

@sheerun sheerun closed this as completed Jan 26, 2016
@sheerun sheerun removed the bug label Jan 26, 2016
@dominikdominik
Copy link

Hi rmaziarka,

I have tried "Long Path Tool" to solve the issue. You may try too.
All the best.

Regards
Dominik

@riona1
Copy link

riona1 commented Jun 16, 2016

you must give a try to "Long Path Tool Program" it will fix this issue

@sheerun
Copy link
Contributor

sheerun commented Jun 16, 2016

You also may try https://github.com/sheerun/npm-packer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

8 participants