Phusion Passenger - SyntaxError: Unexpected token
Phusion Passenger - SyntaxError: Unexpected token
最后通过使用const Vue = require('vue');
解决了使用import Vue from 'vue';
时的Unexpected token: import
后,部署到服务器时出现如下错误。
看起来它试图将 css 文件导入为 javascript,但我不知道为什么会发生这种情况,非常希望得到一些帮助来解决这个问题!
如果您对在 Passenger 中使用 es6 功能有任何了解,我也很想听听!
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
我通过使用 @import "../../node_modules/path_to_css_file"
在我的 build.scss
中导入 css 文件解决了这个问题
最后通过使用const Vue = require('vue');
解决了使用import Vue from 'vue';
时的Unexpected token: import
后,部署到服务器时出现如下错误。
看起来它试图将 css 文件导入为 javascript,但我不知道为什么会发生这种情况,非常希望得到一些帮助来解决这个问题!
如果您对在 Passenger 中使用 es6 功能有任何了解,我也很想听听!
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
我通过使用 @import "../../node_modules/path_to_css_file"
build.scss
中导入 css 文件解决了这个问题