简体   繁体   English

Angular-CodeAnywhere-您似乎不依赖于“ @ angular / core”。 这是一个错误

[英]Angular - CodeAnywhere - You seem to not be depending on “@angular/core”. This is an error

Hey im trying to install Angular Cli but i keep getting failed package install. 嘿,我试图安装Angular Cli,但我一直无法获得成功的软件包安装。 Then i try to start the server and it says You seem to not be depending on "@angular/core". 然后我尝试启动服务器,它说您似乎不依赖于“ @ angular / core”。 This is an error. 这是一个错误。

无法安装套件

检查您是否在终端的项目文件夹中

first check the node 首先检查节点

node -v

and npm are install correctly 和npm已正确安装

npm -v

then try again with 然后再试一次

npm install -g npm@latest 

then you add it in ts file 然后将其添加到ts文件中

const _core = require("@angular/core");

First ensure you have @angular/core install, else run: 首先确保您已安装@angular/core ,否则运行:

npm install @angular/core 

This should get @angular/core install in you node_module and also update itself in your package.json . 这应该在您的node_module中安装@angular/core并在package.json更新。 Also ensure that you're not using an old version of node and NPM, else run from your terminal: 还要确保您没有使用旧版本的节点和NPM,否则请从终端运行:

npm install npm@latest -g 

Then you can add into your js file . 然后,您可以将其添加到js文件中。

const core_1 = require("@angular/core");

This is how I solved this problem on my machine. 这就是我在计算机上解决此问题的方式。

I first ran npm install @angular/core . 我首先运行npm install @angular/core

Then I ran npm install --save . 然后我运行npm install --save

When both installs had successfully completed I ran npm serve and received an error saying 当两个安装都成功完成后,我运行了npm serve并收到一条错误消息:

"Versions of @angular/compiler-cli and typescript could not be determined.
The most common reason for this is a broken npm install.

Please make sure your package.json contains both @angular/compiler-cli and typescript in
devDependencies, then delete node_modules and package-lock.json (if you have one) and
run npm install again."

I then deleted my node_modules folder as well as my package-lock.json folder. 然后,我删除了node_modules文件夹以及package-lock.json文件夹。

After I deleted those folders I ran npm install --save once more. 删除这些文件夹后,我再次运行npm install --save

I ran npm start and received another error. 我运行npm start并收到另一个错误。 This error said Error: Cannot find module '@angular-devkit/core' . 该错误表示Error: Cannot find module '@angular-devkit/core'

I ran npm install @angular-devkit/core --save . 我跑了npm install @angular-devkit/core --save

Finally, I ran npm start and the project started! 最后,我运行了npm start ,项目开始了!

There is some issue with node-sass in codeanywhere due to some permission exceptions. 由于某些权限异常,codeanywhere中的node-sass存在一些问题。 The workaround is go to /usr/lib/node_modules/@angular/cli/ and delete the node_modules folder and then run sudo npm install again create a new project using ng new and try running it . 解决方法是转到/ usr / lib / node_modules / @ angular / cli /并删除node_modules文件夹,然后运行sudo npm install再次使用ng new创建一个新项目并尝试运行它。 It will work 会工作的

How to use 如何使用

Run npm install inside this project folder to install all dependencies. 在该项目文件夹中运行npm install以安装所有依赖项。

Make sure you use the latest version of the CLI (upgrade guide below) 确保使用最新版本的CLI(下面的升级指南)

Run ng serve to see the app in action (try npm start in case ng serve fails). 运行ng serve以查看应用程序的npm start情况(如果ng serve失败,请尝试npm start )。

How to upgrade the CLI 如何升级CLI

Run the below commands - only use "sudo" on Mac/ Linux. 运行以下命令-在Mac / Linux上仅使用“ sudo”。

sudo npm uninstall -g angular-cli @angular/cli

npm cache clean --force

sudo npm install -g @angular/cli

Incase if it fails too 万一也失败了

Delete 'node_modules' folder and 'package-lock.json' file from your project directory 从项目目录中删除“ node_modules”文件夹和“ package-lock.json”文件

Run the below commands in the given order 按给定顺序运行以下命令

npm install

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

npm link

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您似乎不依赖“ @ angular / core”。 这是一个错误 - You seem to not be depending on “@angular/core”. This is an error 你似乎不依赖于“@ angular / core和/或”rxjs“。这是一个错误 - You seem to not be depending on “@angular/core and/or ”rxjs". This is an error 您似乎不依赖于“ @ angular / core”和/或“ rxjs”。 这是一个错误 - You seem to not be depending on “@angular/core” and/or “rxjs”. This is an error “你似乎并不依赖”@angular/core“。” - “You seem to not be depending on ”@angular/core“.” 您似乎不依赖“ @ angular / core”。 这是一个错误。 角项目 - You seem to not be depending on “@angular/core”. This is an error. Angular project 您似乎并不依赖“@angular/core”。 打字稿 - You seem to not be depending on “@angular/core”. Typescript 如何修复“你似乎不依赖于“@angular/core”和/或“rxjs”。在离子中 - How to fix "You seem to not be depending on “@angular/core” and/or “rxjs”. in ionic “您似乎不依赖于“@angular/core”和/或“rxjs”。这是一个错误。“将 MEAN-app 部署到 Heroku 时 - "You seem to not be depending on "@angular/core" and/or "rxjs". This is an error. " when deploying MEAN-app to Heroku 如何在 codeanywhere IDE 中预览 angular 应用程序? - How to preview angular app in codeanywhere IDE? 角度2:根据您所在的位置获取货币价值 - Angular 2 : obtain currency value depending on where you are
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM