在用vite创建react的时候 install完成后输入pnpm run dev 突然蹦出
UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token '??='
一脸闷逼,百度了一下。哦吼, 逻辑空赋值(??=)是ES2021的语法,node v15.0.0以上才支持逻辑空赋值(??=)的语法。之前为了兼容旧代码使用的node版本是14.18.0
nvm启动 https://github.com/coreybutler/nvm-windows/releases
到这边去下载 nvm-setup.exe 需要科学online一下
然后一直点点点点点点点 就安装成功了 去终端试试nvm -v 弹出版本号就成功了
我在安装的时候把旧版本允许导入了 但是nvm ls不出版本号 没办法 重新安装 nvm isntall 14.18.0 安装成功后 nvm use 14 就是旧版本了 装其他版本同理 我装了 16.20.0
但是呢 去vscode上面 node -v 还是14的版本 真行
这时候把vscode关闭 重新打开就是行了 芜湖(关闭当前窗口留存了其他窗口也是不行的哦!)
- UnhandledPromiseRejectionWarning SyntaxError Unexpected token 39syntaxerror unexpected token vite tagoffsetsmap syntaxerror unexpected token unexpected token 39 nvm unexpected token 39 npm unexpected npm token 39 unhandledpromiserejectionwarning syntaxerror syntaxerror unexpected uncaught页面 codepoint syntaxerror unexpected amp my_customer_index syntaxerror unexpected identifier syntaxerror unexpected uncaught invalid