在我对webpack进行了全局安装后,运行webpack -v无法查看版本号并出现以下错误

针对The term ‘webpack‘ is not recognized as the name of a cmdlet问题

node命令没问题但是webpack无效

这时候打开我们的环境变量设置,新建一个系统变量NODE_GLOBAL,他的值就是之前安装nodejs中设置的放置全局安装文件的文件夹路径

针对The term ‘webpack‘ is not recognized as the name of a cmdlet问题

再编辑path系统变量,把这个值加进去

针对The term ‘webpack‘ is not recognized as the name of a cmdlet问题

确定后打开cmd 输入webpack -v

 针对The term ‘webpack‘ is not recognized as the name of a cmdlet问题

ok,然后进入你放置webpack的文件夹

打开命令行

输入Start-Process powershell -Verb runAs

 同意之后再执行set-ExecutionPolicy RemoteSigned 选择 Y

回到webpack文件夹,运行cmd,输入webpack -v

针对The term ‘webpack‘ is not recognized as the name of a cmdlet问题

完成

相关文章: