{"id":12479,"date":"2024-12-27T09:23:36","date_gmt":"2024-12-27T09:23:36","guid":{"rendered":"https:\/\/myprojects.advchaweb.com\/?p=12479"},"modified":"2024-12-28T02:43:01","modified_gmt":"2024-12-28T02:43:01","slug":"install-payload-cms","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2024\/12\/27\/install-payload-cms\/","title":{"rendered":"Install Payload CMS"},"content":{"rendered":"<p>Ref: https:\/\/payloadcms.com\/docs\/getting-started\/installation<\/p>\n<p>Check current node version<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~$ node -v\r\nv16.15.1<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>Use node version 20.9.0+<br \/>\nCheck available node version<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~$ nvm alias \r\ndefault -&gt; 18.18.2 (-&gt; v18.18.2)\r\niojs -&gt; N\/A (default)\r\nunstable -&gt; N\/A (default)\r\nnode -&gt; stable (-&gt; v20.15.1) (default)\r\nstable -&gt; 20.15 (-&gt; v20.15.1) (default)\r\nlts\/* -&gt; lts\/iron (-&gt; N\/A)\r\nlts\/argon -&gt; v4.9.1 (-&gt; N\/A)\r\nlts\/boron -&gt; v6.17.1 (-&gt; N\/A)\r\nlts\/carbon -&gt; v8.17.0 (-&gt; N\/A)\r\nlts\/dubnium -&gt; v10.24.1 (-&gt; N\/A)\r\nlts\/erbium -&gt; v12.22.12 (-&gt; N\/A)\r\nlts\/fermium -&gt; v14.21.3 (-&gt; N\/A)\r\nlts\/gallium -&gt; v16.20.2 (-&gt; N\/A)\r\nlts\/hydrogen -&gt; v18.20.4\r\nlts\/iron -&gt; v20.18.0 (-&gt; N\/A)<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>So use node stable 20.15.1<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~$ nvm use stable\r\nNow using node v20.15.1 (npm v10.7.0)\r\nsatria@teddy:~$ node -v\r\nv20.15.1<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>Create a new dir &#8216;PayloadCMS&#8217;<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~$ cd Documents\/projects\/\r\nsatria@teddy:~\/Documents\/projects$ mkdir payloadcms\r\nsatria@teddy:~\/Documents\/projects$ cd payloadcms\/<\/pre>\n<p>[\/codesyntax]<br \/>\nInstall the Payload CMS (blank)<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~\/Documents\/projects\/payloadcms$ npx create-payload-app\r\nNeed to install the following packages:\r\ncreate-payload-app@3.11.0\r\nOk to proceed? (y) \r\n\r\n\r\n\r\n\u250c   create-payload-app \r\n\u2502\r\n\u25c7   \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502                                               \u2502\r\n\u2502  Welcome to Payload. Let's create a project!  \u2502\r\n\u2502                                               \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\u2502\r\n\u25c7  Project name?\r\n\u2502  PayloadTest\r\n\u2502\r\n\u25c7  Choose project template\r\n\u2502  blank\r\n\u2502\r\n\u25c7  Select a database\r\n\u2502  MongoDB\r\n\u2502\r\n\u25c7  Enter MongoDB connection string\r\n\u2502  mongodb:\/\/127.0.0.1\/payload-test\r\n\u2502\r\n\u2502\r\n\u25c7  Using npm.\r\n\u2502  \r\n\u25c7  Successfully installed Payload and dependencies\r\n\u2502\r\n\u25b2  ? Failed to initialize git repository.\r\n\u2502\r\n\u25c7  [DEBUG] .env.example file successfully updated\r\n\u2502\r\n\u25c7  [DEBUG] .env file successfully created or updated\r\n\u2502\r\n\u25c7  Payload project successfully created!\r\n\u2502\r\n\u25c7   Next Steps  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502                                                     \u2502\r\n\u2502                                                     \u2502\r\n\u2502  Launch Application:                                \u2502\r\n\u2502                                                     \u2502\r\n\u2502    - cd .\/payload-test                              \u2502\r\n\u2502    - npm run dev or follow directions in README.md  \u2502\r\n\u2502                                                     \u2502\r\n\u2502  Documentation:                                     \u2502\r\n\u2502                                                     \u2502\r\n\u2502    - Getting Started                                \u2502\r\n\u2502    - Configuration                                  \u2502\r\n\u2502                                                     \u2502\r\n\u2502                                                     \u2502\r\n\u2502                                                     \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\u2502\r\n\u2514   Have feedback?  Visit us on GitHub.\r\n\r\nnpm notice\r\nnpm notice New major version of npm available! 10.7.0 -&gt; 11.0.0\r\nnpm notice Changelog: https:\/\/github.com\/npm\/cli\/releases\/tag\/v11.0.0\r\nnpm notice To update run: npm install -g npm@11.0.0\r\nnpm notice<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>Launch the App<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~\/Documents\/projects\/payloadcms$ cd .\/payload-test\/\r\nsatria@teddy:~\/Documents\/projects\/payloadcms\/payload-test$ npm run dev\r\n\r\n&gt; payload-test@1.0.0 dev\r\n&gt; cross-env NODE_OPTIONS=--no-deprecation next dev\r\n\r\n   \u25b2 Next.js 15.1.0\r\n   - Local:        http:\/\/localhost:3000\r\n   - Network:      http:\/\/192.168.1.23:3000\r\n   - Environments: .env\r\n   - Experiments (use with caution):\r\n     \u00b7 turbo\r\n\r\n \u2713 Starting...\r\n \u2713 Ready in 1654ms<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>Open it on the browser: http:\/\/localhost:3000\/<br \/>\nBecause it&#8217;s blank, so it&#8217;ll display a message<\/p>\n<h1 class=\"next-error-h1\">404<\/h1>\n<div>\n<h2>This page could not be found.<\/h2>\n<p>Go to the admin page http:\/\/localhost:3000\/admin<br \/>\nNote: Make sure the mongod service is already started. If not, pls start it<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>sudo service mongod start\r\n\r\nsudo service mongod status\r\n\u25cf mongod.service - MongoDB Database Server\r\n     Loaded: loaded (\/lib\/systemd\/system\/mongod.service; disabled; vendor prese&gt;\r\n     Active: active (running) since Fri 2024-12-27 16:52:47 WIB; 2s ago\r\n       Docs: https:\/\/docs.mongodb.org\/manual\r\n   Main PID: 33822 (mongod)\r\n     Memory: 202.2M\r\n        CPU: 759ms\r\n     CGroup: \/system.slice\/mongod.service\r\n             \u2514\u250033822 \/usr\/bin\/mongod --config \/etc\/mongod.conf\r\n\r\nDes 27 16:52:47 teddy systemd[1]: Started MongoDB Database Server.\r\nDes 27 16:52:47 teddy mongod[33822]: {\"t\":{\"$date\":\"2024-12-27T09:52:47.606Z\"},<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>For the first\/empty user, it&#8217;ll be redirected to http:\/\/localhost:3000\/admin\/create-first-user<br \/>\nwith this form<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12487\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-16_57_18.png\" alt=\"\" width=\"581\" height=\"455\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-16_57_18.png 581w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-16_57_18-300x235.png 300w\" sizes=\"auto, (max-width: 581px) 85vw, 581px\" \/><\/p>\n<p>So fill the form with your user.<br \/>\nfor example:<br \/>\nemail: advcha@yahoo.com<br \/>\npassword: Admin@123<\/p>\n<p>So the admin dashboard will be like this<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12489\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-16_59_39.png\" alt=\"\" width=\"1106\" height=\"294\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-16_59_39.png 1106w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-16_59_39-300x80.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-16_59_39-1024x272.png 1024w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-16_59_39-768x204.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<p>You can add any new user and media<\/p>\n<p>The Code<br \/>\nThe config in src\/payload.config.ts<\/p>\n<p>Add Payload Visual Editor &#8211;&gt; DO THIS ON THE PAYLOAD WEB TEMPLATE<br \/>\nRef: https:\/\/www.npmjs.com\/package\/payload-visual-editor<\/p>\n<p>Payload Web Template<br \/>\nThe same steps:<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~\/Documents\/projects\/payloadcms$ npx create-payload-app\r\n\r\n\r\n\u250c   create-payload-app \r\n\u2502\r\n\u25c7   \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502                                               \u2502\r\n\u2502  Welcome to Payload. Let's create a project!  \u2502\r\n\u2502                                               \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\u2502\r\n\u25c7  Project name?\r\n\u2502  PayloadWeb\r\n\u2502\r\n\u25c7  Choose project template\r\n\u2502  website\r\n\u2502\r\n\u25c7  Select a database\r\n\u2502  MongoDB\r\n\u2502\r\n\u25c7  Enter MongoDB connection string\r\n\u2502  mongodb:\/\/127.0.0.1\/payload-web\r\n\u2502\r\n\u2502\r\n\u25c7  Using npm.\r\n\u2502  \r\n\u25c7  Successfully installed Payload and dependencies\r\n\u2502\r\n\u25b2  ? Failed to initialize git repository.\r\n\u2502\r\n\u25c7  [DEBUG] .env.example file successfully updated\r\n\u2502\r\n\u25c7  [DEBUG] .env file successfully created or updated\r\n\u2502\r\n\u25c7  Payload project successfully created!\r\n\u2502\r\n\u25c7   Next Steps  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\r\n\u2502                                                     \u2502\r\n\u2502                                                     \u2502\r\n\u2502  Launch Application:                                \u2502\r\n\u2502                                                     \u2502\r\n\u2502    - cd .\/payload-web                               \u2502\r\n\u2502    - npm run dev or follow directions in README.md  \u2502\r\n\u2502                                                     \u2502\r\n\u2502  Documentation:                                     \u2502\r\n\u2502                                                     \u2502\r\n\u2502    - Getting Started                                \u2502\r\n\u2502    - Configuration                                  \u2502\r\n\u2502                                                     \u2502\r\n\u2502                                                     \u2502\r\n\u2502                                                     \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\r\n\u2502\r\n\u2514   Have feedback?  Visit us on GitHub.<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>Go to the dir &#8216;payload-web&#8217; then run!<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~\/Documents\/projects\/payloadcms$ cd payload-web\/\r\nsatria@teddy:~\/Documents\/projects\/payloadcms\/payload-web$ npm run dev\r\n\r\n&gt; payload-web@1.0.0 dev\r\n&gt; cross-env NODE_OPTIONS=--no-deprecation next dev\r\n\r\n   \u25b2 Next.js 15.1.3\r\n   - Local:        http:\/\/localhost:3000\r\n   - Network:      http:\/\/192.168.1.23:3000\r\n   - Environments: .env\r\n   - Experiments (use with caution):\r\n     \u00b7 turbo\r\n\r\n \u2713 Starting...\r\n \u2713 Ready in 1679ms<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>Open it in your browser: http:\/\/localhost:3000<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12493\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_21_02.png\" alt=\"\" width=\"733\" height=\"345\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_21_02.png 733w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_21_02-300x141.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/p>\n<p>The admin : http:\/\/localhost:3000\/admin<br \/>\nFor the first\/empty user, it&#8217;ll be redirected to http:\/\/localhost:3000\/admin\/create-first-user<br \/>\nSo fill the form with your user.<br \/>\nfor example:<br \/>\nemail: advcha@yahoo.com<br \/>\npassword: Admin@123<br \/>\nName: Admin<\/p>\n<p>So it&#8217;ll be like this<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12494\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_23_03.png\" alt=\"\" width=\"1885\" height=\"723\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_23_03.png 1885w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_23_03-300x115.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_23_03-1024x393.png 1024w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_23_03-768x295.png 768w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_23_03-1536x589.png 1536w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_27-17_23_03-1200x460.png 1200w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<p>We can generate the example content by clicking &#8216;Seed your database&#8217; &#8211;&gt; ONLY ONCE<br \/>\non the admin dashboard http:\/\/localhost:3000\/admin<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12500\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_35_23.png\" alt=\"\" width=\"565\" height=\"354\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_35_23.png 565w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_35_23-300x188.png 300w\" sizes=\"auto, (max-width: 565px) 85vw, 565px\" \/><\/p>\n<p>So the homepage will be like this<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12501\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_37_02.png\" alt=\"\" width=\"1918\" height=\"3170\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_37_02.png 1918w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_37_02-182x300.png 182w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_37_02-620x1024.png 620w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_37_02-768x1269.png 768w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_37_02-929x1536.png 929w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_37_02-1239x2048.png 1239w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_37_02-1200x1983.png 1200w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Add Payload Visual Editor<br \/>\nRef: https:\/\/www.npmjs.com\/package\/payload-visual-editor<br \/>\nInstall<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~\/Documents\/projects\/payloadcms\/payload-web$ npm i payload-visual-editor\r\n\r\nadded 5 packages, and audited 962 packages in 5s\r\n\r\n247 packages are looking for funding\r\n  run `npm fund` for details\r\n\r\n3 vulnerabilities (2 moderate, 1 high)\r\n\r\nSome issues need review, and may require choosing\r\na different dependency.\r\n\r\nRun `npm audit` for details.<\/pre>\n<p>[\/codesyntax]<br \/>\nthen modify the plugin config (NOT IN src\/payload.config.ts BECAUSE IT&#8217;S ALREADY LINKED TO src\/plugins\/index.ts<br \/>\nlike this:<br \/>\n[codesyntax lang=&#8221;javascript&#8221;]<\/p>\n<pre>...\r\n\/ import plugin\r\nimport { visualEditor } from 'payload-visual-editor'\r\n\r\n\/\/ import styles\r\nimport 'payload-visual-editor\/dist\/styles.scss'\r\n...\r\nexport const plugins: Plugin[] = [\r\n  ...\r\n  payloadCloudPlugin(),\r\n  visualEditor({\r\n    previewUrl: () =&gt; `http:\/\/localhost:3000\/pages\/preview`,\r\n    previewWidthInPercentage: 60,\r\n    collections: {\r\n      [COLLECTION_SLUG]: {\r\n        previewUrl: () =&gt; `...`, \/\/ optional individual preview url for each collection\r\n      },\r\n    },\r\n    globals: {\r\n      [GLOBAL_SLUG]: {\r\n        previewUrl: () =&gt; `...`, \/\/ optional individual preview url for each global\r\n      },\r\n    },\r\n  }),\r\n]<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>But when I opened http:\/\/localhost:3000\/admin, it showed this error<br \/>\nFailed to compile<br \/>\n[codesyntax lang=&#8221;text&#8221;]<\/p>\n<pre>.\/node_modules\/payload-visual-editor\/dist\/components\/dropdown\/index.js:30:1\r\nModule not found: Package path .\/dist\/admin\/components\/icons\/Chevron is not exported from package \/home\/satria\/Documents\/projects\/payloadcms\/payload-web\/node_modules\/payload (see exports field in \/home\/satria\/Documents\/projects\/payloadcms\/payload-web\/node_modules\/payload\/package.json)\r\n  28 | Object.defineProperty(exports, \"__esModule\", { value: true });\r\n  29 | exports.Dropdown = void 0;\r\n&gt; 30 | const Chevron_1 = __importDefault(require(\"payload\/dist\/admin\/components\/icons\/Chevron\"));\r\n     | ^\r\n  31 | const react_1 = __importStar(require(\"react\"));\r\n  32 | const Dropdown = (props) =&gt; {\r\n  33 |     const [expanded, setExpanded] = (0, react_1.useState)(false);\r\n\r\nhttps:\/\/nextjs.org\/docs\/messages\/module-not-found\r\n\r\nImport trace for requested module:\r\n.\/node_modules\/payload-visual-editor\/dist\/components\/preview\/iframe\/index.js\r\n.\/node_modules\/payload-visual-editor\/dist\/components\/preview\/index.js\r\n.\/node_modules\/payload-visual-editor\/dist\/components\/visualEditorView\/index.js\r\n.\/node_modules\/payload-visual-editor\/dist\/index.js\r\n.\/src\/plugins\/index.ts\r\n.\/src\/payload.config.ts\r\n.\/src\/app\/(frontend)\/[slug]\/page.tsx<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>it seems visual editor can&#8217;t work with payload cms version 3.x<\/p>\n<p>INSTALL Payload CMS version 2<br \/>\nRef: https:\/\/payloadcms.com\/docs\/v2\/getting-started\/installation<br \/>\nTo find out the payload cms package for npx, pls see https:\/\/www.npmjs.com\/package\/create-payload-app?activeTab=versions<br \/>\nactually there is no the package written for 2.x but there is a another package not 3.x. it&#8217;s 1.1.0. So use this<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~\/Documents\/projects\/payloadcms$ npx create-payload-app@1.1.0\r\nNeed to install the following packages:\r\ncreate-payload-app@1.1.0\r\nOk to proceed? (y) y\r\n\r\n\r\n  Welcome to Payload. Let's create a project! \r\n\r\n\u2714 Project name? \u2026 PayloadWeb2\r\n\u2714 Choose project template \u203a website\r\n\u2714 Select a database \u203a MongoDB\r\n\u2714 Enter MongoDB connection string \u2026 mongodb:\/\/127.0.0.1\/payload-web1\r\n\r\n  Creating project in \/home\/satria\/Documents\/projects\/payloadcms\/payload-web2\r\n\r\n\u2714 Dependencies installed\r\n\u2714 .env file created\r\n\u2714 Payload project successfully created\r\n\r\n  \u2605 Launch Application:\r\n\r\n    - cd .\/payload-web2\r\n    - npm run dev or follow directions in README.md\r\n\r\n  \u2605 Documentation:\r\n\r\n    - Getting Started\r\n    - Configuration<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>note: this is actually payload cms version 2. you can see it in the dependencies in\u00a0 package.json file<br \/>\n[codesyntax lang=&#8221;javascript&#8221;]<\/p>\n<pre>...\r\n\"payload\": \"^2.0.0\",\r\n...\r\n<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>then go to the dir and run!<br \/>\nNote: don&#8217;t forget to start mongod service if it&#8217;s not a;ready started!<br \/>\nsudo service mongod start<br \/>\nif you need pnpm instead of npm, install it like this<br \/>\nnpm install -g pnpm<\/p>\n<p>[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~\/Documents\/projects\/payloadcms$ cd payload-web2\/\r\nsatria@teddy:~\/Documents\/projects\/payloadcms\/payload-web2$ npm run dev\r\n\r\n&gt; PayloadWeb2@1.0.0 dev\r\n&gt; cross-env PAYLOAD_CONFIG_PATH=src\/payload\/payload.config.ts nodemon\r\n\r\n[nodemon] 2.0.22\r\n[nodemon] to restart at any time, enter `rs`\r\n[nodemon] watching path(s): *.*\r\n[nodemon] watching extensions: ts\r\n[nodemon] starting `ts-node src\/server.ts -- -I`\r\n[21:29:02] INFO (payload): Connected to MongoDB server successfully!\r\n[21:29:02] INFO (payload): Starting Payload...\r\n[21:29:03] INFO (payload): Payload Admin URL: http:\/\/localhost:3000\/admin\r\n[21:29:06] INFO (payload): Starting Next.js...\r\n[21:29:06] INFO (payload): Next.js App URL: http:\/\/localhost:3000\r\nwebpack built e3740fda0762bb5561d6 in 12011ms\r\nwebpack compiled successfully\r\n&lt;w&gt; [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: No serializer registered for ConcatSource\r\n&lt;w&gt; while serializing webpack\/lib\/util\/registerExternalSerializer.webpack-sources\/ConcatSource -&gt; Array { 2 items } -&gt; ConcatSource\r\n \u25cb compiling \/page ...\r\n \u2713 Compiled \/page in 5.5s (1111 modules)\r\n \u2713 Compiled \/next\/revalidate\/route in 1266ms (855 modules)\r\n<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>We can generate the example content by clicking &#8216;Seed your database&#8217; &#8211;&gt; ONLY ONCE<br \/>\non the admin dashboard http:\/\/localhost:3000\/admin<\/p>\n<p>Add Payload Visual Editor<br \/>\nRef: https:\/\/www.npmjs.com\/package\/payload-visual-editor<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>satria@teddy:~\/Documents\/projects\/payloadcms\/payload-web2$ npm i payload-visual-editor<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>modify src\/payload\/payload.config.ts<br \/>\n[codesyntax lang=&#8221;javascript&#8221;]<\/p>\n<pre>...\r\n\r\n\/\/ import plugin\r\nimport { visualEditor } from \"payload-visual-editor\";\r\n\r\n\/\/ import styles\r\nimport \"payload-visual-editor\/dist\/styles.scss\";\r\n\r\n...\r\n\r\nexport default buildConfig({\r\n  ...\r\n  plugins: [\r\n    ...\r\n    visualEditor({\r\n      previewUrl: () =&gt; `http:\/\/localhost:3000\/pages\/preview`,\r\n      previewWidthInPercentage: 60,\r\n      \/*collections: {\r\n        [COLLECTION_SLUG]: {\r\n          previewUrl: () =&gt; `...` \/\/ optional individual preview url for each collection\r\n        },\r\n      },\r\n      globals: {\r\n        [GLOBAL_SLUG]: {\r\n          previewUrl: () =&gt; `...` \/\/ optional individual preview url for each global\r\n        },\r\n      },*\/\r\n      collections: {\r\n        pages: {\r\n          previewUrl: () =&gt; `http:\/\/localhost:3000\/pages\/preview`, \/\/ optional individual preview url for each pages collection\r\n        },\r\n        posts: {\r\n          previewUrl: () =&gt; `http:\/\/localhost:3000\/posts\/preview`, \/\/ optional individual preview url for each posts collection\r\n        },\r\n        \/\/ Add more collections as needed\r\n      },\r\n\r\n    }),\r\n  ],\r\n})\r\n<\/pre>\n<p>[\/codesyntax]<br \/>\nnote: can&#8217;t use [COLLECTION_SLUG] and [GLOBAL_SLUG] because they are defined. So add &#8216;pages&#8217; and &#8216;posts&#8217; (probably &#8216;projects&#8217; as well)<br \/>\nbut the previewUrl() still show 404 on the admin visual editor<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12503\" src=\"http:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_42_10.png\" alt=\"\" width=\"1562\" height=\"771\" srcset=\"https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_42_10.png 1562w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_42_10-300x148.png 300w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_42_10-1024x505.png 1024w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_42_10-768x379.png 768w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_42_10-1536x758.png 1536w, https:\/\/myprojects.advchaweb.com\/wp-content\/uploads\/2024\/12\/screenshot-localhost_3000-2024_12_28-09_42_10-1200x592.png 1200w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ref: https:\/\/payloadcms.com\/docs\/getting-started\/installation Check current node version [codesyntax lang=&#8221;bash&#8221;] satria@teddy:~$ node -v v16.15.1 [\/codesyntax] Use node version 20.9.0+ Check available node version [codesyntax lang=&#8221;bash&#8221;] satria@teddy:~$ nvm alias default -&gt; 18.18.2 (-&gt; v18.18.2) iojs -&gt; N\/A (default) unstable -&gt; N\/A (default) node -&gt; stable (-&gt; v20.15.1) (default) stable -&gt; 20.15 (-&gt; v20.15.1) (default) lts\/* -&gt; lts\/iron (-&gt; &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2024\/12\/27\/install-payload-cms\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Install Payload CMS&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[60,13,17],"tags":[],"class_list":["post-12479","post","type-post","status-publish","format-standard","hentry","category-node","category-tutorial","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/12479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=12479"}],"version-history":[{"count":18,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/12479\/revisions"}],"predecessor-version":[{"id":12504,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/12479\/revisions\/12504"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=12479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=12479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=12479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}