Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

grunt with new npm:install has problems on Windows #11143

Closed
Narretz opened this issue Feb 22, 2015 · 9 comments
Closed

grunt with new npm:install has problems on Windows #11143

Narretz opened this issue Feb 22, 2015 · 9 comments
Milestone

Comments

@Narretz
Copy link
Contributor

Narretz commented Feb 22, 2015

The new npm install / caching behavior in grunt is causing some issues. Basically, when the new npm-install scripts tries to remove the contents of the node_modules folder I am getting a whole lot of cannot remove : File or Path name too long.
This is the stupid Windows restriction on very long file paths, I think.
Because of this, the following npm install + shrinkwrap copy is never called, so I am ending up with a half empty node_modules folder.
I can empty the node_modules folder manually and call scripts/npm/install-dependencies.sh directly and this works, but I'd be running into this problem every time the shrinkwrap changes.
Is it possible to delete the contents of node_modules differently?

cc @IgorMinar

@Narretz Narretz added this to the 1.4.0-beta.5 / 1.3.14 milestone Feb 22, 2015
@IgorMinar
Copy link
Contributor

if rm fails, we don't want to try to install because npm will almost certainly not install all the files. so you'll see random errors at runtime.

can you figure out what needs to be done on windows to make the rm command just work?

I don't have easy access to windows nor the required expertise 😞

@Narretz
Copy link
Contributor Author

Narretz commented Feb 23, 2015

It seems we can't use the rm command because Windows has a stupid 260 char restriction on file paths. It's a wontfix on joyents's side: nodejs/node-v0.x-archive#6960
There exists a module that emulates rm -rf specifically for node: https://github.com/isaacs/rimraf but I am not sure what would happen if it removes itself.
Or could we use npm uninstall x for all registered modules? I just checked, this works perfectly
That is, we'd need to get a list of modules in the package.json and then uninstall each of them manually

@IgorMinar
Copy link
Contributor

try rimraf. measure if it adds significant overhead. if it does use it only on windows.

npm uninstall sounds very unefficient, but I don't know if it actually is.

@Bit-Rot
Copy link

Bit-Rot commented Apr 13, 2015

rimraf doesn't seem to like deleting itself. I get build errors attempting this.

I've found success in replacing the rm -rf call in install-dependencies.sh with:

npm ls --depth=0 --parseable=true | xargs npm remove

I'm not confident that this is solution in all environments, however.

@Narretz
Copy link
Contributor Author

Narretz commented Apr 13, 2015

@Bit-Rot have you tried the code in this PR, and if not can you test if it works? #11353

@Bit-Rot
Copy link

Bit-Rot commented Apr 13, 2015

@Narretz Just verified that the code in #11353 works for me. Thanks :)

@xie-qianyue
Copy link

@Narretz I also tested the commit in #11353, it works for me. But why nobody solve the merge problem to make the pull request success?

@chirayuk chirayuk modified the milestones: 1.4.0-rc.1, 1.4.0-rc.2 Apr 24, 2015
@petebacondarwin petebacondarwin modified the milestones: 1.4.x - jaracimrman-existence, 1.4.0-rc.2 May 4, 2015
@AmazingJaze
Copy link

Is this any closer to being resolved? It is also impacting my ability to build Angular on Windows.

@rebornix
Copy link

rebornix commented Aug 6, 2015

+1

gkalpak added a commit to gkalpak/angular.js that referenced this issue Sep 9, 2015
…oss platforms

The previous implementations (based on shell scripts) threw errors on
Windows, because it was not able to `rm -rf` 'node_modules' (due to the
255 character limit in file-paths).

This implementation works consistently across platforms and is heavily based on
'https://github.com/angular/angular/blob/3b9c08676a4c921bbfa847802e08566fb601ba7a/tools/npm/check-node-modules.js'.

Fixes angular#11143
Closes angular#11353
gkalpak added a commit to gkalpak/angular.js that referenced this issue Sep 9, 2015
…oss platforms

The previous implementations (based on shell scripts) threw errors on
Windows, because it was not able to `rm -rf` 'node_modules' (due to the
255 character limit in file-paths).

This implementation works consistently across platforms and is heavily based on
'https://github.com/angular/angular/blob/3b9c08676a4c921bbfa847802e08566fb601ba7a/tools/npm/check-node-modules.js'.

Fixes angular#11143
Closes angular#11353
gkalpak added a commit to gkalpak/angular.js that referenced this issue Sep 9, 2015
…oss platforms

The previous implementations (based on shell scripts) threw errors on
Windows, because it was not able to `rm -rf` 'node_modules' (due to the
255 character limit in file-paths).

This implementation works consistently across platforms and is heavily based on
'https://github.com/angular/angular/blob/3b9c08676a4c921bbfa847802e08566fb601ba7a/tools/npm/check-node-modules.js'.

Fixes angular#11143
Closes angular#11353
gkalpak added a commit to gkalpak/angular.js that referenced this issue Sep 9, 2015
…oss platforms

The previous implementations (based on shell scripts) threw errors on
Windows, because it was not able to `rm -rf` 'node_modules' (due to the
255 character limit in file-paths).

This implementation works consistently across platforms and is heavily based on
'https://github.com/angular/angular/blob/3b9c08676a4c921bbfa847802e08566fb601ba7a/tools/npm/check-node-modules.js'.

Fixes angular#11143
Closes angular#11353
gkalpak added a commit that referenced this issue Sep 23, 2015
…oss platforms

The previous implementations (based on shell scripts) threw errors on
Windows, because it was not able to `rm -rf` 'node_modules' (due to the
255 character limit in file-paths).

This implementation works consistently across platforms and is heavily based on
'https://github.com/angular/angular/blob/3b9c08676a4c921bbfa847802e08566fb601ba7a/tools/npm/check-node-modules.js'.

Fixes #11143
Closes #11353

Closes #12792
gkalpak added a commit that referenced this issue Sep 23, 2015
…oss platforms

The previous implementations (based on shell scripts) threw errors on
Windows, because it was not able to `rm -rf` 'node_modules' (due to the
255 character limit in file-paths).

This implementation works consistently across platforms and is heavily based on
'https://github.com/angular/angular/blob/3b9c08676a4c921bbfa847802e08566fb601ba7a/tools/npm/check-node-modules.js'.

Fixes #11143
Closes #11353

Closes #12792
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants