You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * Module dependencies. */varexpress=require('express');varhttp=require('http');varpath=require('path');varassetManager=require('connect-assetmanager');varassetManagerGroups={js: {route: /\/static\/js\/[0-9]+\/.*\.js/,path: './public/javascripts/lib',dataType: 'javascript',files: ['jquery.js']}};varassetsManagerMiddleware=assetManager(assetManagerGroups);varapp=express();// all environmentsapp.set('port',process.env.PORT||3000);app.set('views',path.join(__dirname,'views'));app.set('view engine','jade');app.use(express.logger('dev'));app.use(express.json());app.use(express.urlencoded());app.use(express.methodOverride());app.use(express.cookieParser('your secret here'));app.use(express.session());// app.use(assetsManagerMiddleware)app.use(require('stylus').middleware(path.join(__dirname,'public')));app.use(express.static(path.join(__dirname,'public')));// development onlyif('development'==app.get('env')){app.use(express.errorHandler());}app.get('/static/js/',express.static(__dirname+'/public/javascripts'));app.get('/static/css/',express.static(__dirname+'/public/stylesheets'));app.get('/static/img/',express.static(__dirname+'/public/images'));app.get('/*',function(req,res){res.render('index',{title: 'Express'});});http.createServer(app).listen(app.get('port'),function(){console.log('Express server listening on port '+app.get('port'));});
When the var assetsManagerMiddleware = assetManager(assetManagerGroups); line is uncommented, the server throws:
ellmo@ellmo~/node/ss2(master)$ node app.js
Express server listening on port 3000
/Users/ellmo/node/ss2/node_modules/connect-assetmanager/node_modules/step/lib/step.js:39
throw arguments[0];
^
Error: watch ENOENT
at errnoException (fs.js:1019:11)
at FSWatcher.start (fs.js:1051:11)
at Object.fs.watch (fs.js:1076:11)
at /Users/ellmo/node/ss2/node_modules/connect-assetmanager/lib/assetmanager.js:114:9
at Array.forEach (native)
at /Users/ellmo/node/ss2/node_modules/connect-assetmanager/lib/assetmanager.js:105:17
at /Users/ellmo/node/ss2/node_modules/connect-assetmanager/lib/assetmanager.js:32:6
at Array.forEach (native)
at Object.settings.forEach (/Users/ellmo/node/ss2/node_modules/connect-assetmanager/lib/assetmanager.js:30:22)
at Function.<anonymous> (/Users/ellmo/node/ss2/node_modules/connect-assetmanager/lib/assetmanager.js:103:12)
As you can see it does that after actually starting the server. I wish there was something to read and debug, but there isn't. I'm at a complete loss.
The text was updated successfully, but these errors were encountered:
Well, this is awkard. I just had the same issue and fixed it... but your issue is several months old. I'll still answer anyway. That error is thrown by fs.watch when it's trying to open a file that doesn't exist. The problem here, is the way connect-assetmanager is concatenating the path and files strings. To workaround this problem, make sure your path property has a trailing slash:
The group.path + file part should read path.join(group.path, file). The method path.join handles having or not having a trailing slash in either path or file, as well as using the correct backward slash (\) in Windows or forward slash (/) everywhere else.
This is my app.js handlerd by express server:
When the
var assetsManagerMiddleware = assetManager(assetManagerGroups);
line is uncommented, the server throws:As you can see it does that after actually starting the server. I wish there was something to read and debug, but there isn't. I'm at a complete loss.
The text was updated successfully, but these errors were encountered: