ember.js 无法找到模块“./transforms/babel插件转换存在检查为宏”

roqulrg3  于 2023-02-15  发布在  Babel
关注(0)|答案(1)|浏览(226)

我最近更新了ember-cli和我的应用程序到4.10.0,并尝试构建:

ember serve

抛出以下错误:

Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'

我已经看过了,看看是什么模块丢失了。我想出了尝试安装/重新安装ember-cli-babel,这也没有工作。
ember应用程序位于LAMP上:Raspbian Linux 11操作系统、Apache 2.4.54、MariaDB 10.5.15和PHP/Laravel 8后端
ember-临界值:4.10.0
ember源:4.10.0
ember-克利-Babel:7.26.11
我没有任何特殊的ember-cli-build配置,如下所示:

'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
     const app = new EmberApp(defaults, {

     });

     return app.toTree();
}

编辑:错误堆栈

- name: Error
  - nodeAnnotation: [undefined]
  - nodeName: [undefined]
  - originalErrorMessage: [undefined]
  - stack: Error: Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'
Require stack:
- /var/www/html/.../node_modules/@ember-data/private-build-infra/src/debug-macros.js
- /var/www/html/.../node_modules/@ember-data/private-build-infra/src/stripped-build-plugins.js
- /var/www/html/.../node_modules/@ember-data/private-build-infra/src/addon-build-config-for-data-package.js
- /var/www/html/.../node_modules/ember-data/index.js
- /var/www/html/.../node_modules/ember-cli/lib/models/package-info-cache/package-info.js
- /var/www/html/.../node_modules/ember-cli/lib/models/package-info-cache/index.js
- /var/www/html/.../node_modules/ember-cli/lib/models/project.js
- /var/www/html/.../node_modules/ember-cli/lib/utilities/get-config.js
- /var/www/html/.../node_modules/ember-cli/lib/utilities/instrumentation.js
- /var/www/html/.../node_modules/ember-cli/lib/cli/index.js
- /usr/local/lib/node_modules/ember-cli/bin/ember

    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.resolve (node:internal/modules/cjs/helpers:109:19)
    at debugMacros (/var/www/html/.../node_modules/@ember-data/private-build-infra/src/debug-macros.js:6:44)
    at module.exports (/var/www/html/.../node_modules/@ember-data/private-build-infra/src/stripped-build-plugins.js:11:48)
    at Class.buildBabelOptions (/var/www/html/.../node_modules/@ember-data/private-build-infra/src/addon-build-config-for-data-package.js:149:62)
    at Class._setupBabelOptions (/var/www/html/.../node_modules/@ember-data/private-build-infra/src/addon-build-config-for-data-package.js:168:33)
    at Class.included (/var/www/html/.../node_modules/@ember-data/private-build-infra/src/addon-build-config-for-data-package.js:184:12)
    at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
    at /var/www/html/.../node_modules/ember-cli/lib/models/addon.js:497:26
    at Array.reduce (<anonymous>)
    at Class.eachAddonInvoke (/var/www/html/.../node_modules/ember-cli/lib/models/addon.js:494:24)
    at Class.included (/var/www/html/.../node_modules/ember-cli/lib/models/addon.js:769:10)
    at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
    at Class.included (/var/www/html/.../node_modules/@ember-data/private-build-infra/src/addon-build-config-for-data-package.js:174:28)
    at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
    at /var/www/html/.../node_modules/ember-cli/lib/broccoli/ember-app.js:721:15
wj8zmpe1

wj8zmpe11#

经过几天的谷歌搜索和尝试各种各样的东西,我能够让我的ember应用程序再次启动。以下是对我有效的方法,不管是什么原因。
我删除了项目node_modules目录中的所有文件

sudo rm -r node_modules/*

重新安装了所有的软件包

npm install

在此之后,我不确定这是否真的与分辨率有关,我将npm9.4.1更新为9.4.2

npm install -g npm@9.4.2

所有这些命令成功执行后,我运行

ember serve

我不再收到上述错误。
我从来没有想过我会用sudo来安装任何npm软件包,至少我试着养成不这样做的习惯,但是,有可能我在多次尝试将我的ember应用程序从4.9升级到4.10时搞砸了。

相关问题