前提
プログラミング初学者です。お手柔らかにお願いします。
windows10 64bitのPCにて
VScodeを使ってJavaScript・Node.Jsの環境構築ができないため
解決策を教えて頂きたいです。
発生している問題・エラーメッセージ
【Powershell単体でnode -vを実行した場合】
PS C:\Users\hoge> node -v v16.16.0
【VScode内ターミナル(Powershell)でnode -vを実行した場合】
node : 用語 'node' は、コマンドレット、関数、スクリプト ファイル、または操作可能なプログ ラムの名前として認識されません。名前が正しく記述されていることを確認し、パスが含まれてい る場合はそのパスが正しいことを確認してから、再試行してください。 発生場所 行:1 文字:1 + node -v + ~~~~ + CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
→再起動後【VScode内ターミナル(Powershell)でnode -vを実行した場合】
PS C:\Users\hoge> node -v node: The term 'node' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
考えたこと・試したこと
・VScodeのターミナルではなく、powershell単体ではnode.jsのインストール・バージョンの確認ができました。
・pythonの環境構築を行った際もパスの設定(?)が煩雑であったので
今回も同様かと思っていますが、VScodeでの設定が分からずにいます。
・いくらか検索したところ、GitやDockerを併用している記事をみかけましたが、今回はnode.jsの学習が目的なので必須でなければ余計なものはインストールしないほうがいいと思っています。
疑問点
・VScodeにてnode.jsを扱える方法があれば教えてください。(不可能であれば教えて頂けると幸いです。)
・上記エラーコードの解消方法を教えて頂きたいです。
・パスの管理や設定のためにできるwindows側の設定や管理方法などがありましたら、教えて頂きたいです。
以上です。宜しくお願い致します。
追加対応
頂いたアドバイスを基に幾つか他のコマンドを実行しました。
【Powershell単体】
$PSHOME
C:\Program Files\PowerShell\7
$PSVersionTable
Name Value ---- ----- PSVersion 7.2.4 PSEdition Core GitCommitId 7.2.4 OS Microsoft Windows 10.0.19043 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0
$env:path.split(";") | select-string node
C:\Program Files\nodejs\
gcm node
CommandType Name Version Source ----------- ---- ------- ------ Application node.exe 16.16.0.0 C:\Program Files\nodejs\node.exe
【VScode内ターミナル(Powershell)】
$PSHOME
C:\Program Files\PowerShell\7
$PSVersionTable
Name Value ---- ----- PSVersion 7.2.4 PSEdition Core GitCommitId 7.2.4 OS Microsoft Windows 10.0.19043 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0
$env:path.split(";") | select-string node
${workspaceRoot}\node_modules\.bin
gcm node
Get-Command: The term 'node' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
settings.json
{ "terminal.integrated.env.windows": { "PATH": "${workspaceRoot}\\node_modules\\.bin;${env:PATH}" }, "terminal.integrated.automationShell.windows": "", "terminal.integrated.shell.windows": "", "terminal.integrated.automationShell.linux": "", "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe", "explorer.confirmDelete": false, "explorer.confirmDragAndDrop": false, "python.defaultInterpreterPath": "C:\\Users\\hogehoge\\AppData\\Local\\Programs\\Python\\Python39\\python.exe", "workbench.editorAssociations": { "*.ipynb": "jupyter.notebook.ipynb" }, "workbench.editor.untitled.hint": "hidden", "security.workspace.trust.untrustedFiles": "open", "editor.autoIndent": "none", "editor.unicodeHighlight.nonBasicASCII": false,

回答1件
あなたの回答
tips
プレビュー