2016-11-06 3 views
1

В моем проекте Wordpress я использую Laravel Elixir, чтобы иметь дело с активами. Все работало до сегодняшнего дня.Запуск gulp дает «path.js: 7 throw new TypeError (« Путь должен быть строкой, получена »+ проверка (путь));

Теперь каждый раз, когда я бегу gulp я получаю:

$ gulp 
path.js:7 
    throw new TypeError('Path must be a string. Received ' + inspect(path)); 
    ^

TypeError: Path must be a string. Received { includePaths: 
    [ 'bower_components/foundation-sites/scss/', 
    'bower_components/slick-carousel/slick' ] } 
    at assertPath (path.js:7:11) 
    at Object.join (path.js:1211:7) 
    at prefixOne (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/laravel-elixir/dist/tasks/GulpPaths.js:143:43) 
    at GulpPaths.prefix (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/laravel-elixir/dist/tasks/GulpPaths.js:153:20) 
    at GulpPaths.src (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/laravel-elixir/dist/tasks/GulpPaths.js:44:25) 
    at getPaths (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/laravel-elixir/dist/tasks/recipes/sass.js:33:33) 
    at Function.<anonymous> (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/laravel-elixir/dist/tasks/recipes/sass.js:21:33) 
    at Function.<anonymous> (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/laravel-elixir/dist/bootstrap/EnableExtension.js:16:18) 
    at /Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/gulpfile.js:7:9 
    at global.Elixir (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/laravel-elixir/dist/index.js:21:5) 

enter image description here

Я подумал, что, может быть, есть что-то не так с моей node_modules каталога, так что я сделал rm -rf node_modules, а затем npm install как обычно. Все потянули, но в конце концов я увидел:

├── UNMET PEER DEPENDENCY [email protected]* 

enter image description here

Я понятия не имею, это неудовлетворенные зависимости, является ли причина. Если это может помочь, это выход из конкретных версий программного обеспечения у меня есть:

node -v

версия 7.0.0

npm -v

3.10.8

gulp -v

[12:26:22] CLI версия 3.9.1 [12:26:22] Локальная версия 3.9.1

Вот my gulpfile.js.

Он не любит массив от includePaths? Могу ли я попросить о помощи? Спасибо.

редактировать:

Это мой package.json:

{ 
    "name": "slick", 
    "version": "1.0.0", 
    "devDependencies": { 
    "gulp": "^3.9.1", 
    "laravel-elixir": "^6.0.0-2" 
    } 
} 

ответ

0

Это решение помогло мне: https://stackoverflow.com/a/40047852/4197938

Проблема заключается в том, что варианты были перемещены от третьего к четвертый параметр.

Поэтому я просто добавил дополнительные null до includePaths.

mix.sass ('приложение.СКС, NULL, NULL < - это решение, {

Затем работает gulp дал

$ gulp 
[13:15:29] Using gulpfile ~/Code/Komarnicki2/wp-content/themes/komarnicki/gulpfile.js 
[13:15:29] Starting 'all'... 
[13:15:29] Starting 'sass'... 
[13:15:29] 'sass' errored after 60 ms 
[13:15:29] Error: Missing binding /Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/node-sass/vendor/darwin-x64-51/binding.node 
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 7.x 

Found bindings for the following environments: 
    - OS X 64-bit with Node.js 6.x 

This usually happens because your environment has changed since running `npm install`. 
Run `npm rebuild node-sass` to build the binding for your current environment. 
    at Object.<anonymous> (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/node-sass/lib/index.js:15:11) 
    at Module._compile (module.js:573:32) 
    at Object.Module._extensions..js (module.js:582:10) 
    at Module.load (module.js:490:32) 
    at tryModuleLoad (module.js:449:12) 
    at Function.Module._load (module.js:441:3) 
    at Module.require (module.js:500:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/gulp-sass/index.js:187:21) 
    at Module._compile (module.js:573:32) 
[13:15:29] 'all' errored after 63 ms 
[13:15:29] Error in plugin 'run-sequence(sass)' 
Message: 
    Missing binding /Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/node-sass/vendor/darwin-x64-51/binding.node 
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 7.x 

Found bindings for the following environments: 
    - OS X 64-bit with Node.js 6.x 

This usually happens because your environment has changed since running `npm install`. 
Run `npm rebuild node-sass` to build the binding for your current environment. 
Stack: 
Error: Missing binding /Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/node-sass/vendor/darwin-x64-51/binding.node 
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 7.x 

Found bindings for the following environments: 
    - OS X 64-bit with Node.js 6.x 

This usually happens because your environment has changed since running `npm install`. 
Run `npm rebuild node-sass` to build the binding for your current environment. 
    at Object.<anonymous> (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/node-sass/lib/index.js:15:11) 
    at Module._compile (module.js:573:32) 
    at Object.Module._extensions..js (module.js:582:10) 
    at Module.load (module.js:490:32) 
    at tryModuleLoad (module.js:449:12) 
    at Function.Module._load (module.js:441:3) 
    at Module.require (module.js:500:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/Users/slick/Code/Komarnicki2/wp-content/themes/komarnicki/node_modules/gulp-sass/index.js:187:21) 
    at Module._compile (module.js:573:32) 

так, то я сделал то, что было написано на выходе

npm rebuild node-sass

и наконец gulp сделал работа

$ gulp 
[13:20:18] Using gulpfile ~/Code/Komarnicki2/wp-content/themes/komarnicki/gulpfile.js 
[13:20:18] Starting 'all'... 
[13:20:18] Starting 'sass'... 
[13:20:19] Finished 'sass' after 900 ms 
[13:20:19] Starting 'scripts'... 
[13:20:19] Finished 'scripts' after 96 ms 
[13:20:19] Starting 'copy'... 
[13:20:19] Finished 'copy' after 52 ms 
[13:20:19] Starting 'version'... 
[13:20:19] Finished 'version' after 56 ms 
[13:20:19] Finished 'all' after 1.11 s 
[13:20:19] Starting 'default'... 
┌───────────────┬──────────────────────────┬─────────────────────────────────────────────────────────────────────────────┬────────────────────┐ 
│ Task   │ Summary     │ Source Files                │ Destination  │ 
├───────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼────────────────────┤ 
│ mix.sass() │ 1. Compiling Sass  │ assets/sass/app.scss              │ public/css/app.css │ 
│    │ 2. Autoprefixing CSS  │                    │     │ 
│    │ 3. Concatenating Files │                    │     │ 
│    │ 4. Writing Source Maps │                    │     │ 
│    │ 5. Saving to Destination │                    │     │ 
├───────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼────────────────────┤ 
│ mix.scripts() │ 1. Concatenating Files │ bower_components/fontfaceobserver/fontfaceobserver.js      │ public/js/all.js │ 
│    │ 2. Writing Source Maps │ assets/js/font.loader.js             │     │ 
│    │ 3. Saving to Destination │ bower_components/jquery/dist/jquery.min.js         │     │ 
│    │       │ bower_components/foundation-sites/dist/foundation.min.js     │     │ 
│    │       │ bower_components/moment/moment.js           │     │ 
│    │       │ bower_components/moment/locale/pl.js          │     │ 
│    │       │ bower_components/bLazy/blazy.js            │     │ 
│    │       │ bower_components/jQuery-viewport-checker/dist/jquery.viewportchecker.min.js │     │ 
│    │       │ bower_components/slick-carousel/slick/slick.min.js       │     │ 
│    │       │ bower_components/masonry/dist/masonry.pkgd.js        │     │ 
│    │       │ bower_components/imagesloaded/imagesloaded.pkgd.js       │     │ 
│    │       │ bower_components/magnific-popup/dist/jquery.magnific-popup.js    │     │ 
│    │       │ assets/js/scripts.js              │     │ 
│    │       │ assets/js/modules/*.js              │     │ 
│    │       │ assets/js/other/*.js              │     │ 
├───────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼────────────────────┤ 
│ mix.copy() │ 1. Saving to Destination │ assets/fonts//**/*               │ public/fonts/  │ 
├───────────────┼──────────────────────────┼─────────────────────────────────────────────────────────────────────────────┼────────────────────┤ 
│ mix.version() │ 1. Versioning   │ public/css/app.css               │ public/build  │ 
│    │ 2. Rewriting File Paths │ public/js/all.js               │     │ 
│    │ 3. Saving to Destination │                    │     │ 
│    │ 4. Copying Source Maps │                    │     │ 
└───────────────┴──────────────────────────┴─────────────────────────────────────────────────────────────────────────────┴────────────────────┘ 
[13:20:19] Finished 'default' after 6.65 ms 

Я до сих пор не знаю, почему все это произошло. Это потому, что недавно я возился с файлом brew при создании my shell scripts (brew install node)? Замечательно, что моя проблема решена, но я недовольна тем, что не знаю, что вызвало ее. Все еще может кто-то внести свой вклад и рассказать мне, что пошло не так?

  • Почему синтаксис был изменен?
  • Почему массив путей пошел на 4-е место в списке аргументов?
  • Как я могу избежать этого в будущем?
  • Что делать, если кто-то решит добавить 5-й, 6-й аргумент?

Был ли это из-за несоответствия версии зависимости? Теперь я боюсь, что это может произойти и в будущем ...

Смежные вопросы