简体   繁体   English

Cloudlinux NodeJS 要求将应用程序的节点模块存储在名为“node_modules”的符号链接指向的单独文件夹(虚拟环境)中

[英]Cloudlinux NodeJS demands to store node modules for application in separate folder (virtual environment) pointed by symlink called "node_modules"

I was looking to deploy my Nodejs/TypeScript web application to my cpanel shared hosting.我正在寻找将我的 Nodejs/TypeScript Web 应用程序部署到我的 cpanel 共享主机。 But, I am getting an error:但是,我收到一个错误:

* *

Cloudlinux NodeJS Selector demands to store node modules for application in a separate folder (virtual environment) pointed by symlink called "node_modules". Cloudlinux NodeJS Selector 要求将应用程序的节点模块存储在一个名为“node_modules”的符号链接指向的单独文件夹(虚拟环境)中。 That's why the application should not contain folder/file with such name in application root*这就是为什么应用程序不应在应用程序根目录中包含具有此类名称的文件夹/文件* 在此处输入图像描述 I have created a nodejs application.我创建了一个 nodejs 应用程序。 The final nodejs/typescript folders-files were moved to the nodejs application directory.最终的 nodejs/typescript 文件夹文件被移动到 nodejs 应用程序目录。 I also was able to install TypeScript as well as run yarn install after copying my virtual environment and running it from my local terminal by running ssh.在复制我的虚拟环境并通过运行 ssh 从本地终端运行它之后,我还能够安装 TypeScript 以及运行 yarn install。

The issues is, from my nodejs application end, I cant 'run any script' or 'npm install' neither can I from my virtual terminal.问题是,从我的 nodejs 应用程序端,我不能从我的虚拟终端“运行任何脚本”或“npm 安装”。 But yarn run real fine.但是纱线运行得很好。 I'm also aware that another folder was created in my root hosting path called /nodevenv/ where another instance of my domain/sub-domain name lives.我还知道在我的根托管路径中创建了另一个文件夹,名为 /nodevenv/ 我的域/子域名的另一个实例所在的位置。 在此处输入图像描述 Node executables folder/files.节点可执行文件夹/文件。 What I dont know is, does it have anything to do with running npm script?我不知道的是,它与运行 npm 脚本有什么关系吗? Again, does it have anything to do with my application path?同样,它与我的应用程序路径有什么关系吗?

Another weird thing I couldn't figure out is how to run the frontend and backend together.我想不通的另一件奇怪的事情是如何同时运行前端和后端。 They both run fine on my local machine.它们都在我的本地机器上运行良好。

  • Do I create a subdomain for the server-side and the frontend from the main domain?我是否从主域为服务器端和前端创建子域?
  • I want them to run together as they were running on the same port from my localhost: 8080.我希望它们一起运行,因为它们在我的本地主机的同一端口上运行:8080。
  • How do I set them to run on the same port from my sharedhosting如何将它们设置为在共享主机的同一端口上运行
  • What I did is, creating a proxy from the frontend package.json file like so: "proxy": "example.com" and it was running fine from local machine.我所做的是,从前端 package.json 文件创建一个代理,如下所示: “proxy”:“example.com” ,它在本地机器上运行良好。

Remove node_modules folder.删除node_modules文件夹。 and try to run your commands again.并尝试再次运行您的命令。

尝试将node_modules移动到公用文件夹

这是因为 node_modules 文件夹已经存在,如果您删除该文件夹,“► Run NPM Install”按钮发送的命令将成功执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM