如何解决在cpanel中运行Nextjs应用程序时出现watchpack错误?

0qx6xfy6  于 2023-06-05  发布在  其他
关注(0)|答案(1)|浏览(174)

我已经上传了nextjs代码到cpanel,然后试图通过npm run dev运行应用程序,但我在下一个js中得到以下错误。

[iamuser@conebar07 public_html]$ npm run dev

> next-demo-app@0.1.0 dev
> next dev -H mydomain.com -p 49000

ready - started server on nextappdomain.com:49000, url: http://nextappdomain.com:49000
info  - Loaded env from /home/iamuser/public_html/.env
Watchpack Error (watcher): Error: EACCES: permission denied, watch '/home'
Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/home'
Watchpack Error (watcher): Error: EACCES: permission denied, watch '/home'
Watchpack Error (initial scan): Error: EACCES: permission denied, scandir '/home'
event - compiled client and server successfully in 8s (170 modules)
wait  - compiling...
event - compiled successfully in 82 ms (134 modules)
wait  - compiling...
event - compiled successfully in 51 ms (36 modules)
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies

下一个js app未添加其他设置。它在我的Windows本地系统中工作得很好。也找不到任何watchpack相关的设置在应用程序中。我只需要在cpanel中更新主目录的权限,还是有任何方法可以在应用程序中更改watchpack路径?

5vf7fwbs

5vf7fwbs1#

我找到了临时的解决办法。这个错误只发生在我从cpanel终端运行命令时,但如果我通过连接putty运行这个命令,它工作正常。

相关问题