laravel npm run dev 仅使用 Nodejs?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47923565/
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 17:08:32  来源:igfitidea点击:

npm run dev with Nodejs only?

node.jslaravelnpmvue.jsovh

提问by Toumaniere

I develop my website on my computer with Laravel and VueJS. On my computer I can run npm run devwithout problems.

我用 Laravel 和 VueJS 在我的电脑上开发我的网站。在我的电脑上,我可以npm run dev毫无问题地运行。

When I commit to Github my website, there is a webhook that runs a script on my hosting to update the real website (on OVH).

当我向 Github 提交我的网站时,有一个 webhook 在我的主机上运行脚本以更新真实网站(在 OVH 上)。

My hosting his is a shared hosting (OVH) with SSH access, there is NodeJS available but not NPM.

我的主机是具有 SSH 访问权限的共享主机 (OVH),有可用的 NodeJS,但没有 NPM。

How could I run npm run devfrom my shared hosting ? Is there a way to run this with NodeJS ?

我怎么npm run dev能从我的共享主机运行?有没有办法用 NodeJS 运行它?

Thanks.

谢谢。

回答by LeGEC

You can try to install npm locally, rather than system wide.

您可以尝试在本地安装 npm,而不是在系统范围内安装。

NVM (https://github.com/nvm-sh/nvm), for example, seems to do the job (disclaimer : I haven't used it yet, I am just looking for a way to set up node/npm without changing my system wide version).

例如,NVM ( https://github.com/nvm-sh/nvm) 似乎可以完成这项工作(免责声明:我还没有使用它,我只是在寻找一种方法来设置 node/npm 而没有更改我的系统范围版本)。

This specific tool will install node and npm somewhere in your $HOME, and additionally tinker your .bashrcso that commands like nodeand npmpoint to the correct scripts or wrappers.

这种特殊的工具将安装节点,NPM某处你$HOME,另外补锅匠你.bashrc,这样的命令状node,并npm指向正确的脚本或包装。

If you have several users on your hosted server, you should make sure that these wrappers are used for your other users too.

如果您的托管服务器上有多个用户,则应确保这些包装器也用于其他用户。