【问题标题】:Phusion Passenger - SyntaxError: Unexpected tokenPhusion 乘客 - SyntaxError:意外的令牌
【发布时间】:2018-11-28 08:23:09
【问题描述】:

在使用import Vue from 'vue';最终解决了Unexpected token: import时使用const Vue = require('vue');后,部署到服务器时出现如下错误。 看起来它试图将 css 文件导入为 javascript,但我不知道为什么会发生这种情况,非常希望有人帮助解决这个问题!

如果您有任何关于让 es6 功能在Passenger 中工作的知识,我也很想听听!

node_modules/bootstrap-social/bootstrap-social.css:10
.btn-social{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.btn-social>:first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,0.2)}
^

SyntaxError: Unexpected token .
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Object.vm.runInThisContext (/usr/share/passenger/helper-scripts/node-loader.js:117:19)
    at Module._compile (module.js:613:28)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)

节点版本:v8.14.0

【问题讨论】:

  • 似乎问题实际上发生在此之前。这只是它发现第一个错误的地方,所以如果我没记错的话,如果没有进一步的细节,任何人都很难帮助你。祝你好运:)
  • @PedroFerrari 在本地运行完美,仅在无法服务的服务器上运行。您需要哪些详细信息?

标签: javascript css node.js vue.js passenger


【解决方案1】:

我通过使用@import "../../node_modules/path_to_css_file" 导入build.scss 中的css 文件解决了这个问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-11-21
    • 2017-08-05
    • 2021-03-31
    • 2019-04-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多