小编Jac*_*yde的帖子

Nuxt.js 找不到模块“@babel/preset-env/lib/utils”

尝试运行时出现此错误 yarn run dev --port=4000

这是错误:

Module build failed (from ./node_modules/babel-loader/lib/index.js):                                                                                                                                                                friendly-errors 16:52:26
Error: /Users/jacob/code/artistrepublik/elite-reviews/.nuxt/client.js: Cannot find module '@babel/preset-env/lib/utils'
Require stack:
- /Users/jacob/code/artistrepublik/elite-reviews/node_modules/@nuxt/babel-preset-app/src/polyfills-plugin.js
- /Users/jacob/code/artistrepublik/elite-reviews/node_modules/@nuxt/babel-preset-app/src/index.js
- /Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/core/lib/config/files/module-types.js
- /Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/core/lib/config/files/configuration.js
- /Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/core/lib/config/files/index.js
- /Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/core/lib/index.js
- /Users/jacob/code/artistrepublik/elite-reviews/node_modules/nuxt-route-meta/dist/index.js
- /Users/jacob/code/artistrepublik/elite-reviews/node_modules/@nuxt/core/dist/core.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at n (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/jiti/dist/v8cache.js:2:2364)
    at PluginPass.Program (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@nuxt/babel-preset-app/src/polyfills-plugin.js:15:34)
    at newFn (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/visitors.js:175:21)
    at NodePath._call (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/path/context.js:92:31)
    at TraversalContext.visitQueue (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/context.js:116:16)
    at TraversalContext.visitSingle (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/context.js:85:19)
    at TraversalContext.visit (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/context.js:144:19)
    at Function.traverse.node (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/index.js:82:17)
    at traverse (/Users/jacob/code/artistrepublik/elite-reviews/node_modules/@babel/traverse/lib/index.js:62:12)
    at …
Run Code Online (Sandbox Code Playgroud)

vue.js babeljs nuxt.js

39
推荐指数
5
解决办法
1万
查看次数

iPhone 6+移动safari iOS 8横向打开标签,Bootstrap navbar-fixed-top打开时不会关闭

我已经遇到了Bootstraps navbar-fixed-top的一个错误,它带有iPhone 6 +在iOS 8上的移动野生动物园.这个错误只会在其他标签打开的情况下发生.

以下是如何复制它:
1)在横向上的iPhone 6+上访问http://getbootstrap.com/examples/navbar-fixed-top/ - 确保打开另一个选项卡
2)向下滚动页面打开崩溃
3)一旦Safari的状态栏(网址和标签)消失,打开导航栏
4)向上滚动以便Safari的状态栏带有标签,
5)尝试关闭导航栏.

我在iOS 7中遇到了这个错误,但是能够通过添加viewport minimal-ui meta来修复它.我已经测试了我的iPhone 6+,以及带有最新版iOS 8的6+ iPhone模拟器.由于普通iPhone 6没有这个问题,因为选项卡没有显示在状态栏上.我想这个bug不仅仅是Bootstrap,而是适用于顶部的任何固定元素.

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<div class="to-sticky navbar-fixed-top">
  <div class="nav-container">
    <div class="navbar">
      <div class="navbar-header">
        <a type="button" class="navbar-toggle btn-secondary btn" data-toggle="collapse" data-target=".navbar-ex1-collapse">
      Main Menu
    </a>
      </div>
      <div class="collapse navbar-collapse navbar-ex1-collapse">
        <ul class="nav navbar-nav" role="menubar">
          <!--unless submenu-->
          <li class="active nav-home first-li ">
            <a href="/" role="menuitem">Home</a>
          </li>
          <li class="nav-dot nav-home">
            <img src="http://assets-production-webvanta-com.s3-us-west-2.amazonaws.com/000000/51/21/original/images/dot.png" alt="" role="presentation">
          </li>
          <!--if submenu-->
          <li class="dropdown …
Run Code Online (Sandbox Code Playgroud)

html css mobile mobile-safari twitter-bootstrap

9
推荐指数
1
解决办法
1179
查看次数

Facebook Pixel 与 Conversion API - 帮助跟踪相同的事件 ID

我在使用 Facebook Conversion API 为 Nuxt.js (Vue) 项目中的像素复制“PageView”事件时遇到了一些令人沮丧的问题。

我最初删除了这个包代码,以便我可以修改以包含每个“PageView”事件的 eventID: https: //github.com/WilliamDASILVA/nuxt-facebook-pixel-module#readme

我的“PageView”事件工作流程是这样的:

  1. 在 Vue 路由器的“afterEach”钩子上,调用跟踪函数。
  2. 当我调用跟踪函数时,对 API 进行异步调用,这将通过“PageView”事件触发服务器转换 API。API 调用返回完全相同的 eventID,因此我们可以在 FE 上进行复制。
  3. 使用给定的 eventID 调用 Facebook 的 Pixel track 方法。

初始负载工作正常:

重复的 PageView 事件

但是,路线更改后的后续呼叫不起作用。服务器级别事件和浏览器级别事件都会被跟踪,但不会重复。

vue 路由器更改后不重复

我注意到的第一件事是没有为浏览器调用设置 eventID。我花了几个小时确保使用 eventID 对浏览器中的 facebook Pixel 调用了正确的函数,确实如此。

我在网上找到了https://gist.github.com/sunderls/dfd5293a8b8f24a4ef37189a1d8c1b46,并开始尝试弄清楚发生了什么。当调用浏览器历史记录的replacestate/pushstate时,事件处理程序似乎会自动添加到像素中。这可以解释为什么没有 eventID 被传递,它会自动触发。

通过查看 Facebook 的文档,我发现我可以设置:

fbq.disablePushState = true

然后,这将阻止像素添加这些事件侦听器。但是,当我在上面添加这行代码时,在初始页面加载后我没有收到任何后续的“PageView”事件,只有服务器事件通过。

这是我的插件源代码:

import { Minimatch } from "minimatch"
import axios from "axios"
import cookie from "js-cookie"

/**
 * @class Fb
 */
class Fb {
  constructor (fbq, options, eventUrl) …
Run Code Online (Sandbox Code Playgroud)

vue.js facebook-pixel nuxt.js

2
推荐指数
1
解决办法
3047
查看次数