Javascript 找不到模块“@angular-devkit/core”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48394003/
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-08-23 04:05:34  来源:igfitidea点击:

Cannot find module '@angular-devkit/core'

javascriptangularecmascript-6angular-cli

提问by azmul hossain

I have created a angular project with Angular CLI: 1.6.3 Node: 9.4.0 OS: linux x64 version. But when want to run my angular app with command ng serve then fetch this error

我用 Angular CLI 创建了一个 angular 项目:1.6.3 节点:9.4.0 操作系统:linux x64 版本。但是当想要使用命令 ng serve 运行我的 angular 应用程序时,然后获取此错误

Cannot find module '@angular-devkit/core'.

找不到模块“@angular-devkit/core”。

回答by Sajeetharan

Try the following steps,

尝试以下步骤,

Step 1:

第1步:

npm update -g @angular/cli

npm update -g @angular/cli

Step 2:

第2步:

Edit your package.json changing the line

编辑您的 package.json 更改行

"@angular/cli": "1.6.0",

"@angular/cli": "1.6.0",

to

"@angular/cli": "^1.6.0",

"@angular/cli": "^1.6.0",

STEP 3:

第 3 步:

npm update

npm update

Refer the steps

参考 steps

回答by krishna murari

Step1:Edit your package.json changing the line

步骤 1:编辑您的 package.json 更改行

@angular/cli": "1.6.4"

to

@angular/cli": "^1.6.4"

Step2:

第2步:

npm update -g @angular/cli 

Step3:

第三步:

npm install --save-dev @angular/cli@latest

I was facing the exact same problem. These three did the tasks for me. You may like to see https://github.com/angular/angular-cli/issues/9307

我面临着完全相同的问题。这三个为我完成了任务。你可能想看https://github.com/angular/angular-cli/issues/9307

回答by inyee

try this out

试试这个

npm install @angular-devkit/core --save-dev

npm install @angular-devkit/core --save-dev

https://github.com/angular/devkit/issues/256

https://github.com/angular/devkit/issues/256

try to update your angular cli

尝试更新您的 angular cli

https://github.com/angular/angular-cli/issues/9307

https://github.com/angular/angular-cli/issues/9307

回答by alexKhymenko

This can happen on different versions on angular-cli. You can install it manually with

这可能发生在 angular-cli 的不同版本上。您可以手动安装它

 npm i -D @angular-devkit/core 

-D is shortcut to --save-dev

-D 是 --save-dev 的快捷方式

Or try the latest version of angular cli

或者尝试最新版本的 angular cli

npm install --save-dev @angular/cli@latest

回答by hoogw

package.json, change to "@angular/cli": "^1.6.5",

package.json, 改为 "@angular/cli": "^1.6.5",

 "devDependencies": {
"@angular/cli": "^1.6.5",
"@angular/compiler-cli": "^5.0.0",

Important, the version could be vary depends on what time.

重要的是,版本可能会因时间而异。

You really should run

你真的应该跑

 npm update -g @angular/cli 

first, to get version, my is 1.6.5

首先,要获取版本,我的是 1.6.5

What does the "^" do?

“^”有什么作用?

 ~1.0.2 means to install version 1.0.2 or the latest patch version such as 1.0.4. 

  ^1.0.2 means to install version 1.0.2 or the latest minor or patch version such as 1.1.0.

last, run this

最后,运行这个

   npm update

回答by JMck

Just run:

赶紧跑:

npm install --save-dev @angular/cli@latest

In the project folder, to fix it.

在项目文件夹中,修复它。

回答by Vineela Thonupunuri

This is what worked for me,

这对我有用,

Go to the folder where you have the project from command line. run the command: npm install @angular-devkit/core

从命令行转到项目所在的文件夹。运行命令: npm install @angular-devkit/core

enter image description here

在此处输入图片说明

If you see the above image, I found some vulnerabilities which needed to fixed.

如果你看到上图,我发现了一些需要修复的漏洞。

run the following commands in sequence: Step 1: npm audit fix Step 2: npm install

依次运行以下命令: Step 1:npm audit fix Step 2:npm install

回答by tolotra

You can do

你可以做

First,

第一的,

Delete the node_modulesfolder

删除node_modules文件夹

Run npm install

npm install

And add devkit to your dev dependancies with npm i -D @angular-devkit/core

并将 devkit 添加到您的开发依赖项中 npm i -D @angular-devkit/core

回答by Arvind Mehta

Step 1: delete package-lock.json Step 2: npm update -g @angular/cli Step 3: update @angular/cli new version in package.json Step 4: npm install

第 1 步:删除 package-lock.json 第 2 步:npm update -g @angular/cli 第 3 步:更新 package.json 中的 @angular/cli 新版本 第 4 步:npm install

It worked for me.

它对我有用。

回答by danilo

I only installed my angular/cli using:
npm install -g @angular/[email protected]
And I started getting this error.

我只使用以下方法安装了我的 angular/cli:
npm install -g @angular/[email protected]
并且我开始收到此错误。

Solution:
If your version is global and
If you don't mind the version of your angular/clithen type:
npm update -g @angular/cli

解决方案:
如果您的版本是全局版本,并且
您不介意angular/cli的版本,则输入:
npm update -g @angular/cli