npm init vite@latest vue3study --template vue

D:\Temp>npm init vite@latest vue3study --template vue
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/create-vite failed, reason: connect ETIMEDOUT 104.16.24.35:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2022-09-28T09_22_21_931Z-debug.log
Install for [ 'create-vite@latest' ] failed with code 1

D:\Temp>

=========================================

D:\Temp>npm init vite@latest vue3study --template vue
npx: installed 1 in 5.686s
C:\Users\Administrator\AppData\Roaming\npm-cache\_npx\17356\node_modules\create-vite\index.js:3
import './dist/index.mjs'
       ^^^^^^^^^^^^^^^^^^

SyntaxError: Unexpected string
    at Module._compile (internal/modules/cjs/loader.js:720:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
    at internal/main/run_main_module.js:17:11

D:\Temp>


=========================================

node版本如何升级

 window系统升级node只能到node官网下载window安装包来覆盖之前的node。

https://nodejs.org/zh-cn/download/

=========================================

 

解决方法:

Windows上,下载最新版本的Node.js,安装。

 

==========================================

PS D:\Temp> node -v
v12.6.0
Need to install the following packages:
  create-vite@3.1.0
Ok to proceed? (y) y vite@latest vue3study --template vue
√ Select a framework: » Vue
√ Select a variant: » JavaScript

Scaffolding project in D:\Temp\vue3study...

Done. Now run:

  cd vue3study
  npm install
  npm run dev

npm notice
npm notice New minor version of npm available! 8.15.0 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g npm@8.19.2 to update!
npm notice
PS D:\Temp> dir


    Directory: D:\Temp


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         8/28/2022   7:01 PM                TxGameDownload
d-----         9/28/2022   9:05 PM                vue3study

==========================================

 <script setup> cannot contain ES module exports. If you are using a previous version of <script setup>, please consult the updated RFC at https://github.com/vuejs/rfcs/pull/227.

 

 

 

删除 setup 即可。

==========================================

 

https://cn.vuejs.org/guide/introduction.html

 

posted @ 2023-10-11 08:35  emanlee  阅读(236)  评论(0编辑  收藏  举报