通过node.js的npm安装gulp打破了windows [英] Installation of gulp through node.js's npm breaks windows

查看:146
本文介绍了通过node.js的npm安装gulp打破了windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Windows机器上使用gulp,除非我尝试使用创建的文件(如推送到github或删除),否则它实际上工作得很好。然后它会中断,因为文件路径太长,似乎是一个相当普遍的问题。 https://github.com/joyent/node/issues/6960#issuecomment-45569604



据我所知,问题出现在npm的嵌套目录中,这些目录扩展了Windows目录的最大字符数,但据我了解,目前还没有任何解决方案。



现在我看到它有三种选择:


  1. 试试通过将缺省值从'node_modules'更改为'n_m'来减少npm目录的字符,并希望这个问题不会被推迟。喜欢这里建议:
    https://github.com/joyent/node / issues / 6960#issuecomment-45569604

然后就是我的问题,我该如何更改默认的'node_modules '目录名?


  1. 将我的开发环境更改为Ubuntu,这是我不喜欢的解决方案,因为我从未使用过Ubuntu的。


  2. 停止使用gulp整体。




  3. 那么,如何更改通过npm创建的默认node_modules目录,或者您实际建议的解决方案是什么? 解决方案

还有一个棘手的选项。

主要问题是gulp有很多嵌套的依赖关系,它会创建非常长的嵌套文件路径。



但是如果你安装了一些在你的main node_modules目录中gulp需要的npm模块,gulp不会停止加载它们作为嵌套。



目前你有类似的东西(这可能不是真正的路径,但想法是相同的):

  \\\
ode_modules\gulp\\\
ode_modules\lodash.bind\\\
ode_modules\lodash._createwrapper ...

如果您将lodash.bind模块作为依赖项添加到项目的package.json中,它将被安装在一个层次上,而不是gulp's dependency

  \\\
ode_modules\gulp
\\\
ode_modules\lodash.bind\\\
ode_modules\lodash ._createwrapper

这会缩短所有网址。你需要用最长的修补程序只修复一个或两个,它会工作。
在我的项目中,添加这个依赖项就足够了:lodash.createcallback和lodash.bind到package.json来修复所有问题。



请记住,为此,您可能需要清除当前的node_modules文件夹。如果因为过长的网址而无法执行此操作,则可以创建符号链接以临时短片文件路径并将其删除。

I want to use gulp on my windows machine and it actually works pretty fine, unless I try to use the created files (like pushing to github or deleting). Then it breaks, because the filepaths are too long and it seems to be a fairly common problem. https://github.com/joyent/node/issues/6960#issuecomment-45569604

I understand that the problem arises through npm's nested directories, which extend the maximal char count for Windows directories, but in my understanding there is not any solution yet.

As I see it right now I have three options:

  1. Try to reduce the chars of npm's directories, by changing the default from 'node_modules' to 'n_m' and hope that problem ist postponed. Like suggested here: https://github.com/joyent/node/issues/6960#issuecomment-45569604

Then it is my question, how exactly do I change the default 'node_modules' directory name?

  1. Change my development environment to Ubuntu, which is frankly a solution I dislike, because I've never used Ubuntu.

  2. Stop using gulp overall.

So, how do I change the default 'node_modules' directory created through npm or what solution do you actually suggest?

解决方案

There is one more tricky option.

Main problem is that gulp has a lot of nested dependencies and it creates very long nested file pathes.

But if you install some of npm modules that gulp requires in your main node_modules directory gulp will not download them as nested.

Currently you have something similar to (this may be not real path you have but idea is the same):

\node_modules\gulp\node_modules\lodash.bind\node_modules\lodash._createwrapper...

If you will add "lodash.bind" module to your project's package.json as dependency it will be installed in one level with gulp and not as gulp's dependency

\node_modules\gulp
\node_modules\lodash.bind\node_modules\lodash._createwrapper

And this will shorter all urls. You will need to fix only one or two with the longest pathes and it will work. In my project it was enough to add this dependencies: "lodash.createcallback" and "lodash.bind" to package.json to fix everything.

Take in mind that befor doing this you probably would need to clear current node_modules folder. If you are not able to do that because off too long url you can create symbolic link to temporary short file path and delete it.

这篇关于通过node.js的npm安装gulp打破了windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆