为什么安装nativescriptpt会导致tns不能被识别为cmdlet的名称



我正在尝试安装nativescript,当我进行npm安装时,它运行良好,但在那之后,当我尝试时

tns doctortns create

它给我的信息是:

The term 'tns' 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 nativescript

有人告诉我,这可能是环境变量的问题,但如果是这样,我不确定需要做什么

我通过将本机描述的节点模块复制到C:\Users\username\AppData\Roaming\npm\node_modules,然后在C:\Users\Users\AppData\Roaming \npm中创建一个名为tns.cmd的文件来解决问题,该文件包含以下内容:

@IF EXIST "%~dp0node.exe" ( "%~dp0node.exe" "%~dp0node_modulesnativescriptbintns" %* ) ELSE ( @SETLOCAL @SET PATHEXT=%PATHEXT:;.JS;=;% node "%~dp0node_modulesnativescriptbintns" %* )

然后它工作

相关内容

最新更新