尝试安装使用无头cms strapi (未完成)

strapi 官网:https://strapi.io/
GitHub 地址:https://github.com/strapi/strapi

中文手册:欢迎来到 Strapi CMS 文档! | Strapi 中文网

FreeBSD下使用strapi(未完成)

安装

npx create-strapi-app@latest my-project --quickstart

为了加快速度,可以加上淘宝的npm加速镜像 

npm config set registry https://registry.npmmirror.com

会提醒登录cloud.strapi.io

可以上下方向键,选择跳过。我们先跳过

提示信息: 

npx create-strapi-app@latest my-project --quickstart
Need to install the following packages:
[email protected]
Ok to proceed? (y)
Create a free account and get:
✨ 30 days of access to the Growth plan, which includes:
✅ Single Sign-On (SSO) login
✅ Content History
✅ Releases

? Please log in or sign up. Skip

 Strapi   Creating a new application at /home/skywalk/work/my-project

   deps   Installing dependencies with npm
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: This package is deprecated. Use the optional chaining (?.) operator instead.


added 1327 packages in 6m

195 packages are looking for funding
  run `npm fund` for details

       ✓  Dependencies installed

    git   Initializing git repository.

       ✓  Initialized a git repository.

 Strapi   Your application was created!
          Available commands in your project:

          Start Strapi in watch mode. (Changes in Strapi project files will trigger a server restart)
          npm run develop

          Start Strapi without watch mode.
          npm run start

          Build Strapi admin panel.
          npm run build

          Deploy Strapi project.
          npm run deploy

          Display all available commands.
          npm run strapi

          To get started run

          cd /home/skywalk/work/my-project
          npm run develop

    Run   Running your Strapi application

> [email protected] develop
> strapi develop

安装完毕,进入目录

cd starlette-example

 启动

npm run develop

FreeBSD jail里的linux下使用strapi(未完成)

 linux下自带的node版本太低,安装22版本

# 使用 Node Version Manager (nvm)(推荐)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
source ~/.bashrc  # 或 ~/.zshrc
nvm install 22    # 安装 Node.js v18
nvm use 22         # 切换到 v18

 安装

npx create-strapi-app@latest my-project --quickstart

Ubuntu22.04使用strapi

  linux下自带的node版本太低,安装22版本

# 使用 Node Version Manager (nvm)(推荐)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
source ~/.bashrc  # 或 ~/.zshrc
nvm install 22    # 安装 Node.js v18
nvm use 22         # 切换到 v18

 安装

npx create-strapi-app@latest my-project --quickstart

安装完成,提示:

 Project information

┌────────────────────┬──────────────────────────────────────────────────┐
│ Time               │ Sat Jul 05 2025 09:31:33 GMT+0000 (Coordinated … │
│ Launched in        │ 18847 ms                                         │
│ Environment        │ development                                      │
│ Process PID        │ 23776                                            │
│ Version            │ 5.17.0 (node v22.17.0)                           │
│ Edition            │ Community                                        │
│ Database           │ sqlite                                           │
│ Database name      │ .tmp/data.db                                     │
└────────────────────┴──────────────────────────────────────────────────┘

 Actions available

One more thing...
Create your first administrator  by going to the administration panel at:

┌─────────────────────────────┐
│ http://localhost:1337/admin │
└─────────────────────────────┘

[2025-07-05 09:31:33.989] info: Strapi started successfully

 网页登录,出来管理登录页面:

尝试安装使用无头cms strapi (未完成)_第1张图片

如果服务器尚未运行,请在终端中将 cd 放入 my-strapi-project 文件夹并运行 npm run develop(或 yarn develop)来启动它 

配置

登录网页后,选择:Tell us a bit more about yourself

可以选前端、后端和全栈

先全一个全栈试试

创建Create a first Collection Type 创建第一个集合类型

具体请看手册:快速入门指南 - Strapi 开发者文档 | Strapi 中文网

安装和基本使用就到这里。

调试

创建项目有报错Could not load js config file 

⠸ Loading Strapi[ERROR]  There seems to be an unexpected error, try again with --debug for more information

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│                                                                                                                      ││   Error: Could not load js config file                                                                               ││   /home/skywalk/work/my-project/node_modules/@strapi/upload/dist/server/index.js: Could not load the "sharp"         ││   module using the freebsd-x64 runtime                                                                               ││   Possible solutions:                                                                                                ││   - Manually install libvips >= 8.15.3                                                                               ││   - Add experimental WebAssembly-based dependencies:                                                                 ││   npm install --cpu=wasm32 sharp                                                                                     ││   npm install @img/sharp-wasm32                                                                                      ││   - Consult the installation documentation:                                                                          ││   See https://sharp.pixelplumbing.com/install                                                                        ││   at loadJsFile (/home/skywalk/work/my-project/node_modules/@strapi/core/dist/utils/load-config-file.js:19:19)       ││   at Object.loadConfigFile                                                                                           ││   (/home/skywalk/work/my-project/node_modules/@strapi/core/dist/utils/load-config-file.js:38:20)                     ││   at loadPlugins (/home/skywalk/work/my-project/node_modules/@strapi/core/dist/loaders/plugins/index.js:126:45)      ││   at async Promise.all (index 3)                                                                                     ││   at async Object.loadApplicationContext                                                                             ││   (/home/skywalk/work/my-project/node_modules/@strapi/core/dist/loaders/index.js:13:5)                               ││   at async Object.register                                                                                           ││   (/home/skywalk/work/my-project/node_modules/@strapi/core/dist/providers/registries.js:28:9)                        ││   at async Strapi.register (/home/skywalk/work/my-project/node_modules/@strapi/core/dist/Strapi.js:322:13)           ││   at async Strapi.load (/home/skywalk/work/my-project/node_modules/@strapi/core/dist/Strapi.js:313:9)                ││   at async Object.develop                                                                                            ││   (/home/skywalk/work/my-project/node_modules/@strapi/strapi/dist/src/node/develop.js:170:32)                        ││   at async action                                                                                                    ││   (/home/skywalk/work/my-project/node_modules/@strapi/strapi/dist/src/cli/commands/develop.js:15:9)                  ││                                                                                                                      │└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

提示解决方案

Possible solutions:                                                                                                ││   - Manually install libvips >= 8.15.3                                                                               ││   - Add experimental WebAssembly-based dependencies:                                                                 ││   npm install --cpu=wasm32 sharp                                                                                     ││   npm install @img/sharp-wasm32                     

安装libvips 

npm install libvips 

安装wasm

npm install --cpu=wasm32 sharp
npm install @img/sharp-wasm32  

安装npm install @img/sharp-wasm32 报错

npm install @img/sharp-wasm32
npm error code EBADPLATFORM
npm error notsup Unsupported platform for @img/[email protected]: wanted {"cpu":"wasm32"} (current: {"cpu":"x64"})
npm error notsup Valid cpu:  wasm32
npm error notsup Actual cpu: x64
npm error A complete log of this run can be found in: /home/skywalk/.npm/_logs/2025-07-04T11_29_41_480Z-debug-0.log

npm看一下

npm fund
work
└── https://opencollective.com/libvips
    └── [email protected], @img/[email protected]

启动npm run develop报错 Creating admin[ERROR]  There seems to be an unexpected error

安装包试试

sudo pkg install wasm3 libwasmtime

不管用,不过报错改了,也许有效果了。仔细看了,报错没有改...

尝试

npm uninstall @swc/core
npm install @swc/core

还是不管用,先放弃。

linux下报错

internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module 'node:path'
Require stack:
- /home/skywalk/.npm/_npx/2d56dd13733e9da7/node_modules/create-strapi-app/dist/index.js
- /home/skywalk/.npm/_npx/2d56dd13733e9da7/node_modules/create-strapi-app/bin/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:85:18)
    at Object. (/home/skywalk/.npm/_npx/2d56dd13733e9da7/node_modules/create-strapi-app/dist/index.js:3:12)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/skywalk/.npm/_npx/2d56dd13733e9da7/node_modules/create-strapi-app/dist/index.js',
    '/home/skywalk/.npm/_npx/2d56dd13733e9da7/node_modules/create-strapi-app/bin/index.js'
  ]
}

ubuntu里npm install 的时候报错

 npm install
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This project is unmaintained
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: This project is unmaintained
npm warn deprecated [email protected]: This package is deprecated. Use the optional chaining (?.) operator instead.
/ELF binary type "0" not known.
\ELF binary type "0" not known.
npm error code 1
npm error path /home/skywalk/work/my-project/node_modules/esbuild
npm error command failed
npm error command sh -c node install.js
npm error node:internal/errors:983
npm error   const err = new Error(message);
npm error               ^
npm error
npm error Error: Command failed: /home/skywalk/work/my-project/node_modules/esbuild/bin/esbuild --version
npm error /home/skywalk/work/my-project/node_modules/esbuild/bin/esbuild: 1: Syntax error: "(" unexpected
npm error
npm error     at genericNodeError (node:internal/errors:983:15)
npm error     at wrappedFn (node:internal/errors:537:14)
npm error     at checkExecSyncError (node:child_process:883:11)
npm error     at Object.execFileSync (node:child_process:919:15)
npm error     at validateBinaryVersion (/home/skywalk/work/my-project/node_modules/esbuild/install.js:101:28)
npm error     at /home/skywalk/work/my-project/node_modules/esbuild/install.js:285:5 {
npm error   status: 2,
npm error   signal: null,
npm error   output: [
npm error     null,
npm error     Buffer(0) [Uint8Array] [],
npm error     Buffer(96) [Uint8Array] [
npm error        47, 104, 111, 109, 101,  47, 115, 107, 121, 119,  97, 108,
npm error       107,  47, 119, 111, 114, 107,  47, 109, 121,  45, 112, 114,
npm error       111, 106, 101,  99, 116,  47, 110, 111, 100, 101,  95, 109,
npm error       111, 100, 117, 108, 101, 115,  47, 101, 115,  98, 117, 105,
npm error       108, 100,  47,  98, 105, 110,  47, 101, 115,  98, 117, 105,
npm error       108, 100,  58,  32,  49,  58,  32,  83, 121, 110, 116,  97,
npm error       120,  32, 101, 114, 114, 111, 114,  58,  32,  34,  40,  34,
npm error        32, 117, 110, 101, 120, 112, 101,  99, 116, 101, 100,  10
npm error     ]
npm error   ],
npm error   pid: 77887,
npm error   stdout: Buffer(0) [Uint8Array] [],
npm error   stderr: Buffer(96) [Uint8Array] [
npm error      47, 104, 111, 109, 101,  47, 115, 107, 121, 119,  97, 108,
npm error     107,  47, 119, 111, 114, 107,  47, 109, 121,  45, 112, 114,
npm error     111, 106, 101,  99, 116,  47, 110, 111, 100, 101,  95, 109,
npm error     111, 100, 117, 108, 101, 115,  47, 101, 115,  98, 117, 105,
npm error     108, 100,  47,  98, 105, 110,  47, 101, 115,  98, 117, 105,
npm error     108, 100,  58,  32,  49,  58,  32,  83, 121, 110, 116,  97,
npm error     120,  32, 101, 114, 114, 111, 114,  58,  32,  34,  40,  34,
npm error      32, 117, 110, 101, 120, 112, 101,  99, 116, 101, 100,  10
npm error   ]
npm error }
npm error
npm error Node.js v22.17.0
npm error A complete log of this run can be found in: /home/skywalk/.npm/_logs/2025-07-04T14_03_59_138Z-debug-0.log
 错误信息分析

主要的错误信息集中在 esbuild 模块的安装过程中:

  • 错误代码‌:npm error code 1
  • 错误路径‌:/home/skywalk/work/my-project/node_modules/esbuild
  • 具体错误‌:执行 /home/skywalk/work/my-project/node_modules/esbuild/bin/esbuild --version 时失败,提示语法错误。

可能的原因‌:

  • esbuild 的二进制文件与当前系统不兼容(如架构不匹配)。
  • Node.js 版本与 esbuild 所需的版本不兼容。
  • esbuild 安装过程中文件损坏。

提醒了

cd /home/skywalk/work/my-project && npm install

执行后还是同样的报错,里面有:

/ELF binary type "0" not known.
ELF binary type "0" not known.

你可能感兴趣的:(多媒体,web)