Gulp.js:解析时意外的令牌(23:12)

时间:2015-06-04 08:20:42

标签: javascript gulp

我正在尝试在我的项目中使用gulp.js,我遇到了一些像这样的问题:

[08:57:25] { [SyntaxError: Unexpected token (23:12) while parsing c:\Users\user\
desktop\responsive\components\scripts\fake_b1eb0d8e.js]
  plugin: 'gulp-browserify',
  showStack: false,
  name: 'SyntaxError',
  message: 'Unexpected token (23:12) while parsing c:\\Users\\user\\desktop\\res
ponsive\\components\\scripts\\fake_b1eb0d8e.js',
  fileName: undefined,
  lineNumber: undefined,
  stack: 'SyntaxError: Unexpected token (23:12) while parsing c:\\Users\\user\\d
esktop\\responsive\\components\\scripts\\fake_b1eb0d8e.js\n    at Stream.end (c:
\\Users\\user\\desktop\\responsive\\node_modules\\gulp-browserify\\node_modules\
\browserify\\node_modules\\insert-module-globals\\index.js:71:21)\n    at _end (
c:\\Users\\user\\desktop\\responsive\\node_modules\\gulp-browserify\\node_module
s\\browserify\\node_modules\\insert-module-globals\\node_modules\\through\\index
.js:65:9)\n    at Stream.stream.end (c:\\Users\\user\\desktop\\responsive\\node_
modules\\gulp-browserify\\node_modules\\browserify\\node_modules\\insert-module-
globals\\node_modules\\through\\index.js:74:5)\n    at Transform.onend (c:\\User
s\\user\\desktop\\responsive\\node_modules\\gulp-browserify\\node_modules\\throu
gh2\\node_modules\\readable-stream\\lib\\_stream_readable.js:523:10)\n    at Tra
nsform.g (events.js:199:16)\n    at Transform.emit (events.js:129:20)\n    at c:
\\Users\\user\\desktop\\responsive\\node_modules\\gulp-browserify\\node_modules\
\through2\\node_modules\\readable-stream\\lib\\_stream_readable.js:965:16\n    a
t process._tickCallback (node.js:355:11)' }

1 个答案:

答案 0 :(得分:0)

我最初遇到了同样的问题,之前我意识到问题是基于css-tricks.com的平滑滚动代码片段,特别是第一行代码

a[href*="#"]:not([href="#"])').click(function()

现在,此选择器无效。 #是一个特殊字符,需要像a[href*=\\#]:not([href=\\#])

一样进行转义

请参阅https://api.jquery.com/category/selectors/

希望它可以帮助某个人