[研究]用nvm-windows 1.1.12 安裝 node.js 和 npm、react
2024-01-07
********************************************************************************
nvm-windows
https://github.com/coreybutler/nvm-windows
https://github.com/coreybutler/nvm-windows/releases/download/1.1.12/nvm-setup.exe
********************************************************************************
Microsoft Windows [版本 10.0.20348.2159] (c) Microsoft Corporation. 著作權所有,並保留一切權利。 C:\>nvm Running version 1.1.12. Usage: nvm arch : Show if node is running in 32 or 64 bit mode. nvm current : Display active version. nvm debug : Check the NVM4W process for known problems (troubleshooter). nvm install <version> [arch] : The version can be a specific version, "latest" for the latest current version, or "lts" for the most recent LTS version. Optionally specify whether to install the 32 or 64 bit version (defaults to system arch). Set [arch] to "all" to install 32 AND 64 bit versions. Add --insecure to the end of this command to bypass SSL validation of the remote download server. nvm list [available] : List the node.js installations. Type "available" at the end to see what can be installed. Aliased as ls. nvm on : Enable node.js version management. nvm off : Disable node.js version management. nvm proxy [url] : Set a proxy to use for downloads. Leave [url] blank to see the current proxy. Set [url] to "none" to remove the proxy. nvm node_mirror [url] : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url. nvm npm_mirror [url] : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to default url. nvm uninstall <version> : The version must be a specific version. nvm use [version] [arch] : Switch to use the specified version. Optionally use "latest", "lts", or "newest". "newest" is the latest installed version. Optionally specify 32/64bit architecture. nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode. nvm root [path] : Set the directory where nvm should store different versions of node.js. If <path> is not set, the current root will be displayed. nvm [--]version : Displays the current running version of nvm for Windows. Aliased as v. C:\>nvm install node 21.5.0 Downloading node.js version 21.5.0 (64-bit)... Extracting node and npm... Complete npm v10.2.4 installed successfully. Installation complete. If you want to use this version, type nvm use 21.5.0 C:\>npm -v 'npm' 不是內部或外部命令、可執行的程式或批次檔。 C:\>nvm install npm Error retrieving "https://nodejs.org/dist/latest-npm/SHASUMS256.txt": HTTP Status 404 C:\>nvm install node lts 21.5.0 Version 21.5.0 is already installed. C:\>nvm use node 21.5.0 Now using node v21.5.0 (64-bit) C:\>npm -v 10.2.4 C:\> C:\>node -v v21.5.0 C:\>nvm install 20.10.0 Downloading node.js version 20.10.0 (64-bit)... Extracting node and npm... Complete npm v10.2.3 installed successfully. Installation complete. If you want to use this version, type nvm use 20.10.0 C:\>node -v v21.5.0 C:\>npm -v 10.2.4 C:\>nvm list * 21.5.0 (Currently using 64-bit executable) 20.10.0 C:\>nvm use 20.10.0 Now using node v20.10.0 (64-bit) C:\>nvm list 21.5.0 * 20.10.0 (Currently using 64-bit executable) C:\> |
安裝 react、建立 react 專案
C:\> C:\nvm>npm install react added 3 packages in 969ms C:\nvm>npm list nvm@ C:\nvm `-- react@18.2.0 C:\nvm>npx create-react-app project1 Need to install the following packages: create-react-app@5.0.1 Ok to proceed? (y) y npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. Creating a new React app in C:\nvm\project1. Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template... added 1484 packages in 2m 250 packages are looking for funding run `npm fund` for details Git repo not initialized Error: Command failed: git --version at checkExecSyncError (node:child_process:890:11) at execSync (node:child_process:962:15) at tryGitInit (C:\nvm\project1\node_modules\react-scripts\scripts\init.js:46:5) at module.exports (C:\nvm\project1\node_modules\react-scripts\scripts\init.js:276:7) at [eval]:3:14 at runScriptInThisContext (node:internal/vm:144:10) at node:internal/process/execution:109:14 at [eval]-wrapper:6:24 at runScript (node:internal/process/execution:92:62) { status: 1, signal: null, output: [ null, null, null ], pid: 6548, stdout: null, stderr: null } Installing template dependencies using npm... added 69 packages, and changed 1 package in 15s 254 packages are looking for funding run `npm fund` for details Removing template package using npm... removed 1 package, and audited 1553 packages in 4s 254 packages are looking for funding run `npm fund` for details 8 vulnerabilities (2 moderate, 6 high) To address all issues (including breaking changes), run: npm audit fix --force Run `npm audit` for details. Success! Created project1 at C:\nvm\project1 Inside that directory, you can run several commands: npm start Starts the development server. npm run build Bundles the app into static files for production. npm test Starts the test runner. npm run eject Removes this tool and copies build dependencies, configuration files and scripts into the app directory. If you do this, you can’t go back! We suggest that you begin by typing: cd project1 npm start Happy hacking! C:\nvm>npm start npm ERR! Missing script: "start" npm ERR! npm ERR! Did you mean one of these? npm ERR! npm star # Mark your favorite packages npm ERR! npm stars # View packages marked as favorites npm ERR! npm ERR! To see a list of scripts, run: npm ERR! npm run npm ERR! A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2024-01-07T12_48_00_276Z-debug-0.log C:\nvm>cd project1 C:\nvm\project1>npm start > project1@0.1.0 start > react-scripts start |
Windows PowerShell 畫面
Compiled successfully! You can now view project1 in the browser. Local: http://localhost:3000 On Your Network: http://192.168.1.32:3000 Note that the development build is not optimized. To create a production build, use npm run build. webpack compiled successfully |
(完)
沒有留言:
張貼留言