如何在 Laravel 5.4 中安装 npm?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44249800/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 16:03:38  来源:igfitidea点击:

How can I install npm in laravel 5.4?

laravelnpmlaravel-5.4

提问by Nurkarim

When I use this command in command mode:

当我在命令模式下使用此命令时:

D:\xampp\htdocs\profileApp>npm run dev

I get this error:

我收到此错误:

'npm' is not recognized as an internal or external command, operable program or batch file.

'npm' 不是内部或外部命令,也不是可运行的程序或批处理文件。

screenshot

截屏

How can I solve this?

我该如何解决这个问题?

回答by manniL

First of all, I assume you are a Windows user. In this case, you need to download and install NPM together with NodeJS from the official website. When installing, do not unselect the "Add to PATH variables" point. It's important that NPM is added to your PATH variables, so it's globally available.

首先,我假设您是 Windows 用户。这种情况需要从官网下载NPM和NodeJS一起安装。安装时,不要取消选择“添加到 PATH 变量”点。将 NPM 添加到您的 PATH 变量中很重要,因此它是全局可用的。

After installing, simply restart your terminal(s)

安装后,只需重新启动终端

回答by Willie Mwewa

Download and install Gitbashit will be used to run such commands. `

下载并安装Gitbash,它将用于运行此类命令。`

Git bash will help you emulate bash commands. Read this articlewith how to use git and npm on windows with Git Bash

Git bash 将帮助您模拟 bash 命令。阅读这篇文章,了解如何使用 Git Bash 在 windows 上使用 git 和 npm

回答by Rahmani Seif El Moulouk

First you need to install Nodewhich comes with NPMbundled in so that it would be recognizable by Windows CMD you can download the latest version from the Official Website.

首先,您需要安装捆绑了NPM 的Node,以便 Windows CMD 可以识别它,您可以从官方网站下载最新版本。

Optional : If you are willing to work on open source projects consider installing Git for windows

可选:如果您愿意从事开源项目,请考虑为Windows安装 Git