2016-06-22 2 views
0

Ниже приведен фрагмент из файла node.js Я пытаюсь скомпилировать код из LESS в CSS. Я пропускаю что-нибудьМЕНЬШИЕ файлы, которые не скомпилированы

app.use(lessMiddleware({ 
    src: path.join(__dirname, '/public/stylesheets/styles', 'less'), 
    dest: path.join(__dirname, '/public/stylesheets/css'), 
    prefix : '/stylesheets', 
})); 

Когда я обновить мою index.html, он бросает меня ниже ошибки

TypeError: Arguments to path.join must be strings 
    at f (path.js:204:15) 
    at Object.filter (native) 
    at Object.exports.join (path.js:209:40) 
    at C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\less-middleware\lib\mi 
ddleware.js:161:27 
    at Layer.handle [as handle_request] (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\n 
ode_modules\express\lib\router\layer.js:95:5) 
    at trim_prefix (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\express\l 
ib\router\index.js:312:13) 
    at C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\express\lib\router\ind 
ex.js:280:7 
    at Function.process_params (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modul 
es\express\lib\router\index.js:330:12) 
    at next (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\express\lib\rout 
er\index.js:271:10) 
    at expressInit (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\express\l 
ib\middleware\init.js:33:5) 
TypeError: Arguments to path.join must be strings 
    at f (path.js:204:15) 
    at Object.filter (native) 
    at Object.exports.join (path.js:209:40) 
    at C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\less-middleware\lib\mi 
ddleware.js:161:27 
    at Layer.handle [as handle_request] (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\n 
ode_modules\express\lib\router\layer.js:95:5) 
    at trim_prefix (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\express\l 
ib\router\index.js:312:13) 
    at C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\express\lib\router\ind 
ex.js:280:7 
    at Function.process_params (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modul 
es\express\lib\router\index.js:330:12) 
    at next (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\express\lib\rout 
er\index.js:271:10) 
    at expressInit (C:\SrkOwnRepo\Hotaaal\HotelUI10892515\node_modules\express\l 
ib\middleware\init.js:33:5) 

Просьба представить обходной путь или любого другого промежуточного программного обеспечения.

ответ

0

less-middleware function имеет другой интерфейс, отличный от того, который вы указали в фрагменте кода.

Похоже, что это lessMiddleware(source, options), где source является строкой и options является объектом. И он разбивается где-то около here, когда он пытается позвонить path.join по телефону source, в вашем случае объект.

Вы можете проверить documentation of the middleware для принятых параметров в параметрах.