gpt4 book ai didi

node.js - 找不到模块 'internal/errors' ionic

转载 作者:搜寻专家 更新时间:2023-10-31 23:58:32 24 4
gpt4 key购买 nike

我正在尝试创建新的 ionic 项目。然后它显示以下错误。我已经删除了 nodejs,npm ,ionic 并再次重新安装。但同样的错误再次出现。 Terminal

错误

Error: Cannot find module 'internal/errors'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at evalmachine.<anonymous>:36:16
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/unzip/node_modules/fstream/node_modules/graceful-fs/fs.js:11:1)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)

Cannot find module 'internal/errors' (CLI v1.7.16)

我的系统信息

Cordova CLI: 7.0.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS
Node Version: v8.5.0

最佳答案

我能够使用 LTS 转到 Node “nvm” 6.4.11 版本让一切正常运转。

$ VER=v6.11.4
$ nvm install $VER
$ nvm alias default $VER
$ nvm use $VER
### now, sadly, we re-install everything to avoid incompatibilities and other issues.
$ mv node_modules node_modules.old
$ mv *.lock node_modules.old
$ npm install
$ npm -g install ionic@1.7 cordova@6 gulp
### the next two may not be needed but it's mostly harmless and maybe helpful
$ ionic platform remove android
$ ionic platform add android

现在,当运行这些相同的命令时,如果幸运的话,您会收到警告:

 ✗ (node:15169) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

哪个不是崩溃...不,这不是崩溃...

最后,不要害怕,在此之后还有其他令人兴奋的修复和不兼容问题值得期待。通常这些应该在其他问题中,但因为您可能也需要这些答案,所以我在这里记录了它们。

您可能还需要添加

ext.cdvCompileSdkVersion = 26
android {
buildToolsVersion "26.0.1"
packagingOptions {
exclude 'META-INF/LICENSE'
}
}

以某种方式添加到您的构建中。一种方法是将其放入名为 build-extras.gradle 的文件中,该文件位于 platforms/android 中。

Note to future readers (2018+): There's nothing magical about "26" - this is the current highest sdk version number as of this writing. You should likely use whatever the current version is in your world of tomorrow if the values above don't work for you.

但是,由于 platforms/ 中的任何内容都可能被 cordova 在 cordova platform add/remove 模式中删除,为了确保我保留它,我把它放在外面那个文件夹。然后在我的构建中,这只是一个 shell 脚本,我这样做:

cp -up misc/build-extras.gradle platforms/android
ionic build android

现在我终于回来了。

关于node.js - 找不到模块 'internal/errors' ionic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46296140/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com