运行 gulp 会给出“path.js:7 throw new TypeError('Path must be a string. Received ' +spect(path));”

2024-05-06

在我的 WordPress 项目中我使用Laravel Elixir来处理资产。直到今天一切都正常。

现在每次我跑步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)

我想我的可能有问题node_modules目录,所以我做了rm -rf node_modules进而npm install照常。一切都被拉了,但最后我看到:

├── UNMET PEER DEPENDENCY stream-browserify@*

我不知道这种未满足的依赖性是否是原因。如果这有帮助,这是我所拥有的特定版本软件的输出:

node -v

v7.0.0

npm -v

3.10.8

gulp -v

[12:26:22] CLI 版本 3.9.1 [12:26:22]本地版本3.9.1

Here is 我的 gulpfile.js https://gist.github.com/komarnicki/269aa177d32495fcc48c94e811eb962a.

它不喜欢来自的数组includePaths?我可以寻求帮助吗?谢谢。

edit:

这是我的 package.json:

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

这个解决方案帮助了我:https://stackoverflow.com/a/40047852/4197938 https://stackoverflow.com/a/40047852/4197938

问题是选项已从第三个移至第二个 第四个参数。

所以我只是添加了额外的null before includePaths.

mix.sass('app.scss', null, null

然后运行gulp gave

$ 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创作时的东西我的 shell 脚本 https://github.com/mattkomarnicki/shell-scripts/blob/master/macOS/setup.sh (brew install node)?很高兴我的问题得到了解决,但我很不高兴,因为我不知道是什么原因造成的。还有人可以贡献并告诉我出了什么问题吗?

  • 为什么语法发生了变化?
  • 为什么路径数组转到参数列表中的第四位?
  • 将来我怎样才能避免这种情况呢?
  • 如果有人决定添加第五个、第六个参数怎么办?

是因为依赖版本不匹配吗?现在我担心这种事将来也会发生......

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

运行 gulp 会给出“path.js:7 throw new TypeError('Path must be a string. Received ' +spect(path));” 的相关文章

  • 网络上的等角柱状图

    我计划为游戏的标记 图钉 构建在线地图 但我无法设置标记的正确纬度 原始地图是一个2048 2048px 的正方形 然后我得到了标记 数千个 地图坐标使用 0 到 100 之间的 x y 表示法设置 0 0 是top left角和100 1
  • 如何正确地将节点从引用传递到上下文?

    我正在尝试将节点从引用传递到上下文 但是因为我在第一次渲染后没有重新渲染 所以传递的节 点是null 我考虑了两种变体 但我认为它们不是最好的 To pass ref代替ref current 但在用例中 我将被迫使用类似的东西contex
  • 鼠标移动时画布拖动

    我正在尝试构建一个可以使用鼠标移动拖动的画布 我做了一些我无法理解的错误 因为一开始似乎有效 然后出现了一个增量错误 使画布移动得太快 考虑以下代码 window onload function var canvas document ge
  • ASP.NET 验证控件和 Javascript 确认框

    我有一个使用 NET 服务器端输入验证控件的页面 此页面还有一个 javascript 确认框 在提交表单时会触发该确认框 当前 当选择 提交 按钮时 会出现 javascript 确认框 一旦确认 就会触发 ASP NET 服务器端验证控
  • 无需重定向的 HTML 页面提交

    有没有什么方法可以在不使用ajax的情况下提交html表单而无需从当前页面重定向 你可以设置一个target 为您form 这样您就可以将表单提交到新选项卡 target blank 或一个小的 隐藏的iframe target nameo
  • 如何在单击按钮时清除反应挂钩中的间隔

    我正在用反应钩子构建一个简单的计时器 我有两个按钮启动和重置 当我单击开始按钮时 handleStart 函数工作正常 计时器启动 但我不知道如何在单击重置按钮时重置计时器 这是我的代码 const App gt const timer s
  • 为某个时刻添加持续时间 (moment.js)

    时刻版本 2 0 0 阅读文档后 http momentjs com docs manipulating add 我认为这很简单 Chrome 控制台 var timestring1 2013 05 09T00 00 00Z var tim
  • document.write 在同一页面上显示内容。

    我对 javascript document write 方法有疑问 大多数情况下 当我使用 document write 时 它会向我显示在不同页面中使用该方法编写的内容 例如 如果我写这样的命令 document write Hello
  • 公开闭包内的方法

    当我们在闭包内创建一个方法时 该方法将成为该闭包的私有方法 并且在我们以某种方式公开它之前无法访问它 怎么可能暴露呢 您可以返回对它的引用 var a function var b function I m private alert go
  • 在 Windows 上使用 IPython 笔记本时出现 500 服务器错误

    我刚刚在 Windows 7 Professional 64 位上全新安装了 IPython 笔记本 我采取的步骤是 从以下位置安装 Python 3 4 1http python org http python org gt pip in
  • 基于范围内变量的角度设置形式动作

    我一直在尝试设置一个搜索表单 可以在其中注入表单操作属性 在我的表格中我有
  • 为什么浏览器允许onmousedown JS改变href?

    我很长时间以来都注意到 当您尝试复制链接位置或在 Facebook 上打开链接时 它会修改链接并将其传递给l php 例如 我可以被发送到 http www facebook com l php u http 3A 2F 2Fwww goo
  • 如何在数据表角度中基于 JSON 动态填充表值?

    我在用着Angular 数据表 https l lin github io angular datatables 我需要能够根据返回的数据动态创建表 换句话说 我不想指定列标题 Example json数据 id 2 city Baltim
  • 将默认搜索文本添加到搜索框 html

    我正在努力将 搜索 文本添加到搜索框 我正在努力实现 onfocus 消失文本 And onblur 重新出现文本 到目前为止 我已经实现了这一点 但我必须将其硬编码为 html eg
  • 从浏览器访问本地文件?

    您好 我想从浏览器访问系统的本地文件 由于涉及大量安全检查 是否可以通过某种方式实现这一目标 或使用 ActiveX 或 Java Applet 的任何其他工作环境 请帮帮我 要通过浏览器访问本地文件 您可以使用签名的 Java Apple
  • Firebase 身份验证和实时应用程序数据库如何保护自身安全?

    从一般开发的角度来看 我很好奇如何保护在线资源的访问 我们使用以下 Firebase 配置参数初始化 Web 应用程序 apikey authdomain projectid databaseurl messagesenderid 服务器如
  • jQuery:向左滑动和向右滑动

    我见过slideUp and slideDown在 jQuery 中 左右滑动的功能 方式怎么样 您可以使用 jQuery UI 中的附加效果来做到这一点 详情请参阅此处 http docs jquery com UI Effects Sl
  • eventSources 到事件 Json,完整日历

    我正在尝试从 eventSources 获取 json 调用到我的事件 我在 eventSources 中返回的 json 是 title Title Test start 1305841052 当我将此字符串传递到事件中时 它会正确显示日
  • Socket.io、集群、快速和同步事件

    1周以来我遇到了一个大问题 我尝试将实际在单核上运行的 node JS 项目转换为具有集群的多核 对于 websockets 目前 我对事件没有任何问题 但是 对于 xhr polling 或 jsonp polling 我在集群模式下使用
  • 突出显示单词并提取其附近文本的函数

    我有一个文本例如 Etiam porta semmalesuada magna mollis euismod 整数取数 ante venenatis dapibus posuere velit aliquet 埃蒂亚姆 门塔 塞姆 male

随机推荐