Mac OS X,Node由Nvm安装,但不能使用全局安装的模块

时间:2022-06-20 20:27:50

The operation system is Mac OS X, After installing Node by using NVM, Node -v shows 9.2. And after installing express globally(npm install -g express), I cannot use express in the command line. If it is used, it will prompt that the module is not defined. Using npm root -g to find the installation of node path, in the lib or bin directory I can see the global installation of the package, but I can't be able to add lib or bin directory in the environment path, because there is no executable file in these two directories. Any suggestions are very helpful, thanks.

操作系统是Mac OS X,使用NVM安装Node后,Node -v显示9.2。在全局安装express之后(npm install -g express),我不能在命令行中使用express。如果使用它,将提示未定义模块。使用npm root -g查找节点路径的安装,在lib或bin目录下我可以看到包的全局安装,但我无法在环境路径中添加lib或bin目录,因为有这两个目录中没有可执行文件。任何建议都非常有用,谢谢。

1 个解决方案

#1


0  

The command-line program express is not installed with npm install express, no matter the command line parameters passed to it. To use the command line utility, you must globally install the package express-generator, like this:

命令行程序express不与npm install express一起安装,无论传递给它的命令行参数如何。要使用命令行实用程序,必须全局安装package express-generator,如下所示:

npm install -g express-generator

You also should probably install normal express to your individual project, and not globally

您也应该为您的个别项目安装普通快递,而不是全局

#1


0  

The command-line program express is not installed with npm install express, no matter the command line parameters passed to it. To use the command line utility, you must globally install the package express-generator, like this:

命令行程序express不与npm install express一起安装,无论传递给它的命令行参数如何。要使用命令行实用程序,必须全局安装package express-generator,如下所示:

npm install -g express-generator

You also should probably install normal express to your individual project, and not globally

您也应该为您的个别项目安装普通快递,而不是全局