我在系统上安装了node和npm,但是当我尝试使用npx创建react-app甚至为节点应用程序运行npm start时,我看到以下错误。 在C:\ Users \ DELL \ Desktop \ ReactApp \ my-app中创建一个新的React应用。
The term '/d' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included
, verify that the path is correct and try again.
At line:1 char:3
+ /d <<<< /s /c npm --version
+ CategoryInfo : ObjectNotFound: (/d:String) [], CommandNotFoundE
xception
+ FullyQualifiedErrorId : CommandNotFoundException
DELL@DELL-PC MINGW64 ~/Desktop/ReactApp
$ npx create-react-app my-app
Creating a new React app in C:\Users\DELL\Desktop\ReactApp\my-app.
The term '/d' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included
, verify that the path is correct and try again.
At line:1 char:3
+ /d <<<< /s /c npm --version
+ CategoryInfo : ObjectNotFound: (/d:String) [], CommandNotFoundE
xception
+ FullyQualifiedErrorId : CommandNotFoundException.
答案 0 :(得分:0)
我遇到了同样的情况。解决方案是重新启动新下载的Visual Studio Code,它将获得NPM和Node的正确路径。