我已经安装了 express 和 express-generator 但仍然无法正常工作但是我可以在 node_modules 中看到这两个文件夹

I have installed express and express-generator but still its not working however i can see both the folders in node_modules

安装 express 和 express-generator 后我无法使用 'express' 关键字。

试过这个命令

npm install express 

npm install express-generator
cmd> express --v

在 cmd 中检查 express --v 时,它应该显示已安装的版本,但我收到以下错误。

express : The term 'express' 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:1 + express --v + ~~~~~~~ + CategoryInfo : ObjectNotFound: (express:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

为了能够在终端中使用 express,您需要全局安装包。

npm i -g express
express

如果您没有全局安装它,那么您只能在您的项目范围内从 package.json 脚本访问它。

参考 link -> https://docs.npmjs.com/misc/scripts