无法找到模块'内部/错误'离子 [英] Cannot find module 'internal/errors' ionic

查看:199
本文介绍了无法找到模块'内部/错误'离子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建新的离子项目。然后它显示以下错误。
i已移除 nodejs npm ionic 并重新安装。但同样的错误再次显示。
航站楼

I'm trying to create new ionic project.then it show below error. i have removed nodejs,npm ,ionic and re install again.but same error showing again. 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 版本6.4.11, nvm 让事情发挥作用。

I was able to go to the node "LTS" version of 6.4.11 with nvm to get things to work.

$ 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

现在运行相同的命令时,如果你现在很幸运,你会收到警告:

Now when running those same commands, if you're lucky now you'll get a warning instead:

 ✗ (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.

这不是崩溃......不,这不是崩溃......

Which is not a crash ... no, it's not a crash ...

最后,不要害怕,在此之后会有其他令人兴奋的修复和无比的期待。通常那些应该在其他问题中,但因为你可能也需要那些答案,我在这里记录了它们。

Finally, fear not, there's other exciting fixes and incompatilibites to look forward to after this. Usually those should be in other questions but because you'll probably need those answers as well I've documented them here.

您可能还需要添加

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

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

to your build somehow. One way is to put this into a file named build-extras.gradle which lives in platforms/android.


未来读者注意事项(2018+):26没有什么神奇之处 - 这是本文撰写时当前最高的sdk版本号。如果上述值不适合您,您应该使用当前版本的明天世界。

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.

但是,由于平台/ 中的任何内容可能会被 cordova平台添加/删除模式中的cordova删除,以确保我保留它周围,我把它放在那个文件夹之外。然后在我的构建中,这只是一个shell脚本,我这样做:

However, since anything in platforms/ might be removed by cordova in the cordova platform add/remove pattern, to make sure I keep it around, I put it outside that folder. Then in my build, which is just a shell script, I do this:

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

现在我终于恢复了生意。

And now finally I'm back in business.

这篇关于无法找到模块'内部/错误'离子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆