Tag: gruntjs

在VM共享目录中安装npm模块和grunt问题

我试图把开发环境放在一起,npm正在导致我的问题。 这是我的情况: 我有一台运行Windows和VMWare Player的开发机器。 我有一个configuration了Apache,PHP,NodeJS等的Ubuntu服务器虚拟机(没有用户界面)。由于虚拟机没有用户界面,我想使用主机操作系统进行开发。 我在VM中设置了一个共享目录,作为/ mnt / hgfs / source / <project name>来访问。 当我试图在这个目录下运行npm install时,问题就出现了。 我看到很多错误,如Error: UNKNOWN, symlink '../requirejs/bin/r.js' 。 我知道我的package.json文件是可以的,因为如果我将所有文件从共享中复制到常规的unix目录(/ var / www / <项目名称>), npm install工作正常。 所以npm在共享目录中安装模块时有问题。 我想我可以通过在全球范围内安装节点软件包来解决这个问题,但无论出于何种原因,GruntJS爱好者都不喜欢这个 ,它必须在本地。 然后我尝试创build一个从全局到本地的npm链接,但这只是导致一个新的错误: Error: May not delete: /usr/lib/node_modules/grunt 。 我对/ usr / lib / node_modules目录和所有子目录拥有完全权限。 我真的不想在虚拟机中使用命令行文本编辑器来编写整个项目,但看起来我无法通过VMWare在主机和客户机操作系统中都可以访问我的代码库。 我非常感谢任何有关如何1)允许将npm模块安装到我的共享目录中的build议,2)全局运行Grunt,或者3)解决我所看到的npm链接错误。 编辑 :发布后不久,我意识到这里的根本问题 – 当主机操作系统是Windows时,无法在虚拟机共享目录中创build符号链接。 由于npm install默认使用符号链接,所以它不起作用,这就是为什么接受的解决scheme能够工作。

Grunt连接不以错误开始“根path必须是一个string”

我试图设置我的Gruntfile使用grunt连接npm模块。 我尝试使用grunt clean server命令启动服务器时遇到问题。 它的错误与行: Warning: root path must be a string Use –force to continue. 我真的不确定我搞错了什么configuration,可以使用另一套眼睛。 这是我的Gruntfile: /* global module, conf */ var modRewrite = require('connect-modrewrite'); var mountFolder = function(connect, dir) { return connect.static(require('path').resolve(dir)); }; module.exports = function(grunt) { grunt.initConfig({ copy: { base: { files: [ {src: "index.html", dest: "BUILD/index.html"}, {expand: true, src: "app/**", […]

无法将Sails.js应用程序投入生产

我试图用Sails.js将我的应用程序投入生产,但无法通过咕噜声的任务。 这是我收到的错误: error: Error: The hook `grunt` is taking too long to load. Make sure it is triggering its `initialize()` callback, or else set `sails.config.grunt._hookTimeout to a higher value (currently 20000) at tooLong [as _onTimeout] (/usr/local/lib/node_modules/sails/lib/app/private/loadHooks.js:92:21) at Timer.listOnTimeout (timers.js:110:15) 我大大增加了sails.config.grunt._hookTimeout ,但仍然没有完成。 在生产或开发输出中运行sails debug : Grunt :: Error: listen EADDRINUSE at exports._errnoException (util.js:746:11) at Agent.Server._listen2 (net.js:1156:14) […]

用.bat文件启动节点服务器

我想用.bat文件启动一个节点服务器,因为每次启动它时,都必须运行一个咕噜的任务。 我在start.bat尝试了以下几行: grunt build node index.js 当我执行它时,它只是运行grunt build命令,然后停止。 如果我删除了grunt build命令,它会运行node index.js就好了。 我究竟做错了什么?

GruntJS,多任务和grunt.option

我开始为我的一个项目使用GruntJS。 我轻而易举地完成了使用简单的别名编写一个简单的构build脚本。 然而,我的脚本包含许多基本相同的任务,唯一的区别是一些参数,如源文件夹和目标文件夹。 例如: sass: { options:{ trace: true, debugInfo: true, style: 'compressed' }, html: { files: { 'build/html/css/main.css': 'sass/html.sass' } }, html2: { files: { 'build/html2/css/main.css': 'sass/html2.sass' } }, html3: { files: { 'build/html3/css/main.css': 'sass/html3.sass' } } } 我想实现的是只有一个任务,然后将参数(dest,src)传递给该任务。 我试图用MultiTasks来实现这个function: grunt.registerTask('sass2', 'Run all Sass compilation tasks.', function() { var projects = ['html','html2','html3']; projects.forEach(function(proj){ grunt.config.set('sass.files.dest', […]

Grunt并发任务不输出

我想我的基于Grunt的安装程序同时运行“testing”(即unit testing)和“服务器”(即Web服务器),以便我可以做grunt testAndServer来运行两者文件被改变)在同一个terminal。 代码(大部分是基于yo angular支架): // in initConfig: concurrent: { testAndWebServer: [ 'karma', 'watch' ] }, 然后 grunt.registerTask('testAndServer', function (target) { if (target === 'dist') { return grunt.task.run(['build', 'open', 'connect:dist:keepalive']); } grunt.task.run([ 'clean:server', 'concurrent:server', 'autoprefixer', 'compass', 'connect:livereload', 'open', 'concurrent:testAndWebServer' ]); }); 这实际上工作,但我没有得到任何输出在terminal(PowerShell)窗口。 我想karma任务显示testing的结果。 我怎么能实现这个目标? 我在一台四核机器上运行Windows 7上的Node.js v0.10.20。

Grunt任务退出总线错误:10

我正在使用下面的JSHint Grunt任务,这是传递好的: jshint: { options: { ignores: ['js/characters/**/*.js','js/libs/**/*.js','js/text.js','js/video.js'], predef: ['define', 'require'], reporter: require('jshint-stylish'), curly: true, eqnull: true, eqeqeq: true, undef: false, }, all: ['js/**/*.js'], } 我正在尝试将其configuration为在监视任务中工作: watch: { scripts: { files: ['<%= jshint.all %>'], ignores: ['js/characters/**/*.js','js/libs/**/*.js','js/text.js','js/video.js'], tasks: ['jshint'] }, css: { files: ['**/*.sass'], tasks: ['compass'], options: { livereload: true, } } } 但每次我改变一个JS文件,手表退出Bus error: 10

如何使用Mocha,GrunttestingNodeJS应用程序?

也许有人遇到过关于“如何使用mocha,gruntjstestingnodejs应用程序”的npm module / tutorial / guide / article? 会很高兴有任何build议。

如何只将maven执行目标定位到构build文件夹?

我有一个项目使用Maven和前端Maven的插件(com.github.eirslett)。 当我运行mvn install从插件运行mvn install所有的执行,并且他们在src/main/webapp根目录下创build一个node_modules , bower_components和node文件夹,其中实际的前端代码是。 问题是,我想只mvn install执行,并在build目录中创build包,而不是在版本化的应用程序代码中创build这些包,就像在Java库中一样。 有没有办法做到这一点? 这是我的pom.xml的相关部分: <build> <directory>build</directory> <outputDirectory>build/classes</outputDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>UTF-8</encoding> <webResources> <resource> <filtering>true</filtering> <directory>src/main/webapp</directory> <includes> <include>WEB-INF/weblogic.xml</include> </includes> </resource> </webResources> </configuration> </plugin> … <plugin> <groupId>com.github.eirslett</groupId> <artifactId>frontend-maven-plugin</artifactId> <version>0.0.20</version> <configuration> <workingDirectory>src/main/webapp</workingDirectory> </configuration> <executions> <execution> <id>install node and npm</id> <goals> <goal>install-node-and-npm</goal> </goals> <configuration> <nodeVersion>v0.10.34</nodeVersion> <npmVersion>2.1.11</npmVersion> </configuration> </execution> […]

Grunt任务输出,然后调用grunt-notify

Grunt通知: https : //github.com/dylang/grunt-notify是伟大的。 但是,这似乎有点有限。 据我可以告诉我所有的消息需要预先生成。 所以第一个问题是我怎样才能生成通知? 接下来,似乎基于错误或某个任务的成功,grunt通知触发器。 我猜基于std in / out / err? 这种情况下,问题是如果一些任务不使用这些。 如果有编译错误,grunt指南针不使用stderr。 那么如何在发生错误时运行grunt通知? 这会导致下一个问题。 我如何从一个咕task任务抓住控制台输出或标准错误?