我正在尝试通过 Ubuntu 20.04 上的 npm 使用“npm rundevelop”运行一个 Strapi 项目。该代码来自我的一个小组项目,没有其他人遇到这些问题。
Error: ./.cache/plugins/strapi-plugin-content-manager/admin/src/components/RepeatableComponent/Banner.js 2:87
Module parse failed: Unexpected token (2:87)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
我已经尝试过这些线程上的解决方案:Strapi 开发命令失败 https://stackoverflow.com/questions/66856970/strapi-develop-command-failed,
如何修复“模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):”? https://stackoverflow.com/questions/56098779/how-to-fix-module-build-failed-from-node-modules-babel-loader-lib-index-js
两者都没有奏效。
我也尝试过:
- 重新安装Ubuntu
- 重新安装 Babel
- 降级或尝试不同版本的 Babel
这是我项目的 package.json,希望能够提供更多上下文
{
"name": "my-project",
"private": true,
"version": "0.1.0",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/preset-env": "^7.13.15",
"babel-loader": "^8.2.2",
"webpack": "^5.33.2"
},
"dependencies": {
"knex": "0.21.18",
"sqlite3": "5.0.0",
"strapi": "3.5.4",
"strapi-admin": "3.5.4",
"strapi-connector-bookshelf": "3.5.4",
"strapi-plugin-content-manager": "3.5.4",
"strapi-plugin-content-type-builder": "3.5.4",
"strapi-plugin-email": "3.5.4",
"strapi-plugin-graphql": "3.5.4",
"strapi-plugin-upload": "3.5.4",
"strapi-plugin-users-permissions": "3.5.4",
"strapi-utils": "3.5.4"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "ab32cbf0-3e4d-42ea-a078-e816435ef1f7"
},
"engines": {
"node": ">=10.16.0 <=14.x.x",
"npm": "^6.0.0"
},
"license": "MIT"
}
我只是不正确地使用我的 package.json 文件吗?任何提示或方向将不胜感激。