programing

Visual Studio Code에서 로컬 웹 서버를 설정하는 방법

elecom 2023. 6. 7. 22:09
반응형

Visual Studio Code에서 로컬 웹 서버를 설정하는 방법

저는 VS 코드 신입이고 타자기 일을 하고 있습니다.HTML 파일을 열기 위해 로컬 서버 경로를 설정하려고 합니다.설정 방법 및 항상 설정하려고 하면 오류가 발생합니다.터미널에서 이(NPM 설치) 및 (NPM 시작) 명령을 사용할 수 없습니다.이 명령을 사용하면 오류가 발생합니다.대리인 문제라도?VS 코드에서 이 문제를 해결하는 방법은 무엇입니까?

폴더 구조:

TsDemo--folder name

.vscode
   ->launch.json
   ->tasks.json
out
    ->app.js
    ->app.js.map

app.ts
index.html 
tsconfig.json

저는 이 링크를 팔로우했습니다: https://blogs.msdn.microsoft.com/cdndevs/2016/01/24/visual-studio-code-and-local-web-server/ 하지만 작동하지 않습니다.다음 명령을 사용하는 경우: D:\TsDemo >NPM 설치

        D:\TsDemo>npm install
        npm ERR! code ETIMEDOUT
        npm ERR! errno ETIMEDOUT
        npm ERR! network request to https://registry.npmjs.org/lite-server failed, reason: connect ETIMEDOUT 10.232.192.45:8080
        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\AppData\Roaming\npm-cache\_logs\2017-12-20T14_16_49_680Z-debug.log

다음 명령을 사용하는 경우: D:\TsDemo >NPM 시작

        D:\TsDemo>npm start
        >TSDEMO@1.0.0 start D:\TsDemo
        > npm run lite

        npm WARN invalid config loglevel="notice"

        > TSDEMO@1.0.0 lite D:\TsDemo

        >lite-server --port 10001

        'lite-server' is not recognized as an internal or external command,
        operable program or batch file.
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! TSDEMO@1.0.0 lite: `lite-server --port 10001`
        npm ERR! Exit status 1
        npm ERR!
        npm ERR! Failed at the TSDEMO@1.0.0 lite script.
        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
        npm WARN Local package.json exists, but node_modules missing, did you mean to install?


        npm ERR! A complete log of this run can be found in:
        npm ERR!     C:\Users\411732\AppData\Roaming\npm-cache\_logs\2017-12-20T14_07_41_636Z-debug.log
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! TSDEMO@1.0.0 start: `npm run lite`
        npm ERR! Exit status 1
        npm ERR!
        npm ERR! Failed at the TSDEMO@1.0.0 start script.
        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
        npm WARN Local package.json exists, but node_modules missing, did you mean to install?

        npm ERR! A complete log of this run can be found in:
        npm ERR!     C:\Users\AppData\Roaming\npm-cache\_logs\2017-12-20T14_07_41_694Z-debug.log    

Live Server Extension을 사용하면 됩니다.VS Code에서 직접 설치하면 됩니다.그러면 편집기 하단에 서버를 자동으로 시작 및 실행하고 HTML을 즉시 볼 수 있는 링크가 있습니다.

Live-server-web-extensionLive Server도 확인합니다.

언급URL : https://stackoverflow.com/questions/47908158/how-to-set-local-web-server-in-visual-studio-code

반응형