node.js 找不到模块 node_modules\@ionic\app-scripts IONIC 3

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46021115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:28:48  来源:igfitidea点击:

Cannot find module node_modules\@ionic\app-scripts IONIC 3

node.jscordovaionic-frameworknpmionic3

提问by Muhammed Yal??n Kuru

I have installed npm 3.10.10then i have installed ionic 3.9.2and cordova 7.0.1.

我已经安装npm 3.10.10然后我有installed ionic 3.9.2cordova 7.0.1

i have tried the following steps:

我尝试了以下步骤:

  1. ionic start newProject

    (selected a tabs project)

  1. ionic start newProject

    (选择了一个标签项目)

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

  1. ionic serve
  1. ionic serve

this command will throwthe error

该命令将throwerror

Error: Cannot find module 'E:\firstProject\node_modules\@ionic\app-scripts'

错误:找不到模块“E:\firstProject\node_modules\@ionic\app-scripts”

i found only this thread Error: Cannot find module '@ionic/app-scripts'.

我只找到了这个线程错误:找不到模块 '@ionic/app-scripts'

i don't want to downgrade my nodejs version,as i want to use latest feature

我不想降级我的 nodejs 版本,因为我想使用最新功能

but i tried,

但我试过了

npm i @ionic/app-scripts(SAG Answer)

npm i @ionic/app-scripts( SAG 答案)

i'm getting same errorafter executing above command

error执行上述操作后,我得到了相同的结果command

please help me without downgrading nodejsversion

请在不降级的情况下帮助我 nodejsversion

EDIT 1 (as per sampath suggestion) :below is my package.jsonfile

编辑 1(根据 sampath 建议):以下是我的package.json文件

{
  "name": "firstProject",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/core": "3.12.1",
    "@ionic-native/splash-screen": "3.12.1",
    "@ionic-native/status-bar": "3.12.1",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "3.6.0",
    "ionicons": "3.0.0",
    "rxjs": "5.4.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@ionic/app-scripts": "2.1.4",
    "typescript": "2.3.4"
  },
  "description": "An Ionic project"
}

when i run ionic infoit is giving some kind of error

当我运行ionic info它时会出现某种错误

$ ionic info

$ 离子信息

enter image description here

在此处输入图片说明

EDIT 2: (After sampath Answer)

编辑 2: (在 sampath 回答之后)

  1. i did the following changes
  1. 我做了以下更改
i removed `"@ionic/app-scripts": "2.1.4"`
i removed `"@ionic/app-scripts": "2.1.4"`
  1. $ npm install @ionic/app-scripts@latest --save-dev

  1. $ npm install @ionic/app-scripts@latest --save-dev

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

post $ npm install @ionic/app-scripts@latest --save-dev , package.json file will look like below

post $ npm install @ionic/app-scripts@latest --save-dev ,package.json 文件将如下所示

enter image description here

在此处输入图片说明

please help me thanks in advance!!!!

请帮助我在此先感谢!!!!

回答by Muhammed Yal??n Kuru

Guys i solved this issue. Just want to share with you to save your time at least. Follow steps.

伙计们,我解决了这个问题。只是想与您分享,以至少节省您的时间。按照步骤操作。

  1. Remove node_modules.
  2. Downgrade Node to version 6 (run npm install node@6or brew install node@6)
  3. Add "@ionic/app-scripts": "3.1.9"under dependencies in project.json
  4. npm i
  1. 删除node_modules
  2. 将 Node 降级到版本 6(运行npm install node@6brew install node@6
  3. "@ionic/app-scripts": "3.1.9"在依赖项下添加project.json
  4. npm i

回答by Sampath

Remove "@ionic/app-scripts": "2.1.4"from your package.jsonfile firstly.

首先"@ionic/app-scripts": "2.1.4"从您的package.json文件中删除 。

According to your ionic info, you have a problem with app-scripts.So you can install latestas shown below.

根据你的ionic info,你有问题app-scripts。所以你可以latest如下图安装。

and after that compile:

然后编译:

npm install @ionic/app-scripts@latest --save-dev

Remove "@ionic/app-scripts": "2.1.4"from your package.jsonfile firstly.

首先"@ionic/app-scripts": "2.1.4"从您的package.json文件中删除 。

Updatefrom Git

从 Git更新

Running on Windows you might try:

在 Windows 上运行您可以尝试:

  1. Set environment in local command window and verify problem:

    set OPENSSL_CONF=c:\dummy
    npm -v

  1. 在本地命令窗口中设置环境并验证问题:

    set OPENSSL_CONF=c:\dummy
    npm -v

=> you now probably see this ssl error message

=> 您现在可能会看到此 ssl 错误消息

  1. Remove environment and verify problem is gone:

    set OPENSSL_CONF=npm -v

  1. 删除环境并验证问题是否消失:

    set OPENSSL_CONF=npm -v

=> no ssl error message

=> 没有 ssl 错误消息

回答by Ananta Prasad

Only install the latest version of @ionic/app-scripts

只安装最新版本的@ionic/app-scripts

npm install @ionic/app-scripts@latest --save-dev

回答by Adham Amiin

Run:

跑:

npm install @ionic/app-scripts@latest --save-

to install app-script.

安装app-script.

Then:

然后:

npm install

To install node_modulesto avoid Typescript error

安装node_modules以避免打字稿错误

And it worked for me.

它对我有用。

回答by wilfredo daza

I had the same error. I tried update npm , reinstall app-script. I uninstalled node and npm, and then installed again and work it. I think that error was because the version of npm instaltion was diferent to the original instalation of node

我有同样的错误。我尝试更新 npm ,重新安装应用程序脚本。我卸载了 node 和 npm,然后再次安装并运行它。我认为这个错误是因为 npm 安装的版本与 node 的原始安装不同

回答by ganesh

try deleting node_modules folder and do npm installagain this might solve your problem

尝试删除 node_modules 文件夹并npm install再次执行这可能会解决您的问题