在VM共享目录上运行`grunt` [英] Running `grunt` on VM Shared Directory

查看:124
本文介绍了在VM共享目录上运行`grunt`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在Windows主机和Linux guest中使用Vagrant时, grunt 在尝试运行作业时返回了以下错误。

据我所知,这个文件路径超过了主机客户机共享目录中的255个字符的Windows限制。

  npm ERR!错误:EPERM,打开'/ u01 / aa / bb / build / share / app-core / app- 
ui / node_modules / grunt-contrib-imagemin / node_modules / pngquant-bin / node_modules / bin-
wrapper / node_modules / download / node_modules / request / node_modules / form-
data / node_modules / combined-stream / test / integration / test-delayed-streams-and-buffers-
and-strings.js '

我可以在客户VM上的非共享目录上开发,但我更愿意使用共享目录,因为我在主机上使用IDE。



如何解决此问题,以便我可以运行 grunt 在共享目录上?

解决方案

我在使用角度生成器运行yeoman时遇到类似问题。我现在找到的解决方案是利用npm处理它的依赖关系和文件夹结构



请考虑您遇到的问题可能只影响几个文件(并且可能只包含imagemin模块)。 b
$ b

对于Yeoman而言,我的解决方案是首先生成,跳过自动启动的安装:

  yo角度appname --skip-install 

手动启动bower安装:

  bower install 

从这里开始应该对你有意思:安装requestnpm模块作为第一级模块(而不是以后深入解决的依赖项):

  npm install request --save-dev 

因此,如果您现在运行常规npm install来获取剩下的米使用已经存在的请求模块。

  npm install --no-bin-links 

请注意,使用 - no-bin-links 也是一件好事想法,如果你不想以管理员身份运行VirtualBox

所以,回答你的问题。如果你正确地设置你的软件包并在之前调用npm install,运行grunt应该可以工作。模块请求是一个任意模块,用于阻止 test-delayed-streams-and-buffers-and-strings.js 文件的大路径。

Using Vagrant with a Windows host and Linux guest, grunt returned the following error when trying to run a job.

As I understand, this file path exceeds the 255 character limit of Windows when on a host-guest shared directory.

npm ERR! Error: EPERM, open '/u01/aa/bb/build/share/app-core/app-
ui/node_modules/grunt-contrib-imagemin/node_modules/pngquant-bin/node_modules/bin-
wrapper/node_modules/download/node_modules/request/node_modules/form-
data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-
and-strings.js'

I could develop on a non-shared directory on my guest VM, but I'd prefer to use a shared directory since I use an IDE on the host.

How can I fix this issue so that I can run grunt on the shared directory?

解决方案

I experienced a similar issue while running yeoman with angular-generator. The solution I found right now is a little trick leveraging the way npm handles it's dependencies and folder structure.

Please consider that the problem you are experiencing is probably only affecting a few files (and probably only the imagemin module).

For Yeoman my solution was to first generate, skipping the automatically started installation:

yo angular appname --skip-install

Starting bower installation manually:

bower install

Starting from here it should be interesting to you: Install "request" npm module as first level module (instead of a depencdency deeply resolved inside imagemin later):

npm install request --save-dev

So if you now run the regular npm install to fetch the remaining modules, the already existing request module is used.

npm install --no-bin-links

Please note that using --no-bin-links is also a good idea if you don't want to run VirtualBox as an Administrator.

So, to answer your question. Running grunt should work if you correctly setup your packages and call npm install before. The module "request" is an arbitrary module that prevents the big path of the test-delayed-streams-and-buffers-and-strings.js file.

这篇关于在VM共享目录上运行`grunt`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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