简体   繁体   English

如何将错误“意外令牌”修复到Sapper项目中

[英]How fix error “Unexpected token” into Sapper project

I used nvm to switch node js from 10.14.1 to 10.15.3, started the project npm run dev and got an error. 我使用nvm将节点js从10.14.1切换到10.15.3,启动项目npm run dev并出错。

C:\user\project>npm run dev
> sapper dev
 ✗ server
 Unexpected token (1:63) 
 ✗ client Unexpected token (1:63)

Did: remove and reinstall packages 做了:删除并重新安装软件包

> rm -rf `node_modules`
> npm i

This is syntax error into components. 这是组件中的语法错误。 If at the beginning into component <button on:click></button> add ="" into end on:click and start project npm run dev , get error 如果在开始时进入组件<button on:click></button>添加=""进入结束on:click并启动项目npm run dev ,获取错误

C:\Users\admin\project> npm run dev         

> web_channel-mnp_om@0.0.1 dev C:\Users\admin\project
> sapper dev

✗ server
Unexpected token (1:63)
✗ client
Unexpected token (1:63)

If at the beginning run project npm run dev after into component <button on:click></button> add ="" into end on:click , get error 如果在开始运行项目npm run dev后进入组件<button on:click></button> add =""结束on:click ,获取错误

(node:6220) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'fileName' of undefined
    at _loop_1 (C:\Users\admin\my-project\node_modules\sapper\dist\core.js:354:111)
    at new RollupResult (C:\Users\admin\my-project\node_modules\sapper\dist\core.js:358:17)
    at class_1.<anonymous> (C:\Users\admin\my-project\node_modules\sapper\dist\core.js:528:46)
    at class_1.emit (events.js:189:13)
    at Watcher.emit (C:\Users\admin\my-project\node_modules\rollup\dist\rollup.js:38118:22)
    at C:\Users\admin\my-project\node_modules\rollup\dist\rollup.js:38163:19
(node:6220) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6220) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✗ client
Unexpected token (1:63)
(node:6220) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'imports' of undefined
    at C:\Users\admin\my-project\node_modules\sapper\dist\core.js:267:15
    at Set.forEach (<anonymous>)
    at extract_css (C:\Users\admin\my-project\node_modules\sapper\dist\core.js:266:30)
    at RollupResult.to_json (C:\Users\admin\my-project\node_modules\sapper\dist\core.js:394:18)
    at handle_result (C:\Users\admin\my-project\node_modules\sapper\dist\dev.js:262:55)
    at C:\Users\admin\my-project\node_modules\sapper\dist\dev.js:346:17
    at class_1.<anonymous> (C:\Users\admin\my-project\node_modules\sapper\dist\core.js:528:37)
    at class_1.emit (events.js:189:13)
    at Watcher.emit (C:\Users\admin\my-project\node_modules\rollup\dist\rollup.js:38118:22)
    at C:\Users\admin\my-project\node_modules\rollup\dist\rollup.js:38163:19
(node:6220) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

Conclusion: Need to delete ="" 结论:需要删除=""

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM