无法找到模块’./transforms/babel-plugin-convert-existence-checks-to-macros’。

huangapple go评论46阅读模式
英文:

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

问题

我最近更新了ember-cli和我的应用程序到4.10.0版本,尝试使用以下命令构建:

ember serve

出现以下错误:

找不到模块 './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-cli版本:4.10.0

ember-source版本:4.10.0

ember-cli-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();
}

编辑:错误堆栈

- 错误名称:Error
- 节点注释:[未定义]
- 节点名称:[未定义]
- 原始错误消息:[未定义]
- 堆栈:Error: 找不到模块 './transforms/babel-plugin-convert-existence-checks-to-macros'
需要的模块栈:
- /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/.../node_modules/ember-cli/lib/utilities/get-config.js
- /var/www/.../node_modules/ember-cli/lib/utilities/instrumentation.js
- /var/www/.../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
英文:

I've recently updated ember-cli and my app to 4.10.0, and trying to build with:

ember serve

throws the following error:

Cannot find module &#39;./transforms/babel-plugin-convert-existence-checks-to-macros&#39;

I've looked to see what module is missing. I came up with trying to install/reinstall ember-cli-babel and that didn't work either.

The ember app is on LAMP: Raspbian Linux 11 OS, Apache 2.4.54, MariaDB 10.5.15, and PHP/Laravel 8 backend

ember-cli: 4.10.0

ember-source: 4.10.0

ember-cli-babel: 7.26.11

I don't have any special ember-cli-build configurations, here it is:

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

     });

     return app.toTree();
}

EDIT: ERROR STACK

  - name: Error
  - nodeAnnotation: [undefined]
  - nodeName: [undefined]
  - originalErrorMessage: [undefined]
  - stack: Error: Cannot find module &#39;./transforms/babel-plugin-convert-existence-checks-to-macros&#39;
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 (&lt;anonymous&gt;)
    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

答案1

得分: 0

经过几天的Google搜索和尝试各种方法,我终于能够再次启动我的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时,我可能弄砸了一些地方。

英文:

After days of googling and trying a variety of things, I was able to get my ember application to launch again. Here is what worked for me, for whatever reason.

I removed all the files inside my projects node_modules directory

sudo rm -r node_modules/*

and reinstalled all those packages with

npm install

After this, and I'm not sure if this really had anything to do with the resolution, I updated npm from 9.4.1 to 9.4.2

npm install -g npm@9.4.2

Once all of those commands executed successfully, I ran

ember serve

and I no longer received the above error.

I hadn't thought I ever used sudo to install any npm packages, at least I try to make it a habit not to. But, it's possible I screwed up during my many butchered attempts at updating my ember app from 4.9 to 4.10.

huangapple
  • 本文由 发表于 2023年2月6日 11:19:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75357054.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定