简体   繁体   English

“你似乎并不依赖”@angular/core“。”

[英]“You seem to not be depending on ”@angular/core“.”

When I try to build my project running the following command:当我尝试运行以下命令构建我的项目时:

ng build --environment=prod --aot=false  --output-path="..." --base-href="..."

You seem to not be depending on @angular/core .你似乎并不依赖@angular/core

This is an error, however, I don't understand why because before it worked well.这是一个错误,但是,我不明白为什么,因为之前它运行良好。

I tried to do this:我试图这样做:

npm install @angular/core 

But I get this error :但我收到此错误:

error at Error (native) error { Error: EACCES: permission denied, chown '' error at Error (native) error errno: -13, error code: 'EACCES', error syscall: 'chown', error Please try running this command again as root/Administrator. verbose exit [ -13, true ]

I also tried to get rid of node_modules , then make an install npm: but I get the same error.我也试图摆脱node_modules ,然后安装 npm: 但我得到了同样的错误。

And when I run the following command:当我运行以下命令时:

ng serve

I have another error:我还有一个错误:

The "@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler-cli'

This is my package.json :这是我的package.json

"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"

"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@types/jquery": "^3.2.17",
"cli-color": "^1.2.0",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"matrix-js-sdk": "^0.8.5",
"moment": "^2.18.1",
"olm": "https://matrix.org/packages/npm/olm/olm-2.2.2.tgz",
"readline": "^1.3.0",
"rxjs": "^5.4.1",
"socket.io-client": "^2.0.3",
"zone.js": "^0.8.14"

"@angular/cli": "1.2.6",
"@angular/compiler-cli": "^4.0.0",
"@angular/language-service": "^4.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/jquery": "^3.2.17",
"@types/node": "~6.0.60",
"codelyzer": "~3.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.3.3"

Not sure whether below approach will solve your problem or not, please try once.不确定以下方法是否能解决您的问题,请尝试一次。

I have also faced the same issue while executing below command.在执行以下命令时,我也遇到了同样的问题。

D:\My_Project>ng serve

Then I have followed below steps and it worked for me.然后我按照以下步骤操作,它对我有用。

D:\My_Project>npm link
D:\My_Project>ng serve

If this is not working kindly let me know I will try to reproduce the error which you are getting and try to give you solution as soon as possible.如果这不起作用,请告诉我,我会尝试重现您遇到的错误,并尽快为您提供解决方案。

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

In case it fails万一失败

Delete node_modules folder and package-lock.json file from your project directory Run the below commands in the given order-从项目目录中删除node_modules文件夹和package-lock.json文件 按给定顺序运行以下命令-

npm install

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

npm link

I went down the list of installing the various dependencies as prompted in the terminal.我按照终端中的提示在安装各种依赖项的列表中找到了。 I am running on Windows so I also installed windows Build Tools.我在 Windows 上运行,所以我还安装了 Windows 构建工具。

I ran ng serve and got "You seem to not be depending on "@angular/core" and/or "rxjs". This is an error."我运行 ng serve 并得到“你似乎不依赖于“@angular/core”和/或“rxjs”。这是一个错误。

Then ran然后跑了

npm link

followed by其次是

ng serve

Everything is now running.现在一切都在运行。 Not sure how much of what I did was necessary/redundant but I can now build Angular projects.不确定我所做的有多少是必要的/多余的,但我现在可以构建 Angular 项目。

Faced the same issue and solved by executing the npm link command.遇到同样的问题并通过执行npm link命令解决。

When we run npm link in a module's root directory, npm creates a symbolic link from our “global node_modules” directory to the local module's directory当我们在模块的根目录中运行npm link时,npm 会创建一个从“全局 node_modules”目录到本地模块目录的符号链接

The “global node_modules” directory is a special directory where all modules installed with npm install -g are stored. “global node_modules”目录是一个特殊的目录,所有通过npm install -g模块都存储在其中。 We can find the path to our global node_modules directory by running npm root -g我们可以通过运行npm root -g找到全局 node_modules 目录的路径

Visit :- https://medium.com/@alexishevia/the-magic-behind-npm-link-d94dcb3a81af访问:- https://medium.com/@alexishevia/the-magic-behind-npm-link-d94dcb3a81af

Stupid fix愚蠢的修复

Removing node_modules and installing the packages again npm i or yarn worked for me!删除node_modules并再次安装软件包npm iyarn对我node_modules

@Sunil Kumar Sahu is correct. @Sunil Kumar Sahu 是正确的。

Using "ng link" means it connects your current application to your root/parent application that you have on your machine.使用“ng link”意味着它将您当前的应用程序连接到您机器上的根/父应用程序。 When you run your application, any changes you make to the dependency will be reflected in the application.当您运行应用程序时,您对依赖项所做的任何更改都将反映在应用程序中。

After this, just run "ng serve" .在此之后,只需运行"ng serve"

Link : https://codurance.com/2016/12/21/how-to-use-npm-link/链接: https : //codurance.com/2016/12/21/how-to-use-npm-link/

  • Prakhar普拉哈尔

检查项目文件夹上是否有 node_modules 文件夹。

I solved my issue with this same exact error with npm link followed by ng serve .我用npm link后跟ng serve解决了同样的错误。 I was told by another forum that this may be a result of an empty node_modules folder.另一个论坛告诉我,这可能是因为node_modules文件夹为空。 Please let me know if this works for you.请让我知道这是否适合您。

just try using this code to disable depending @angular/core and/or rxjs只需尝试使用此代码禁用依赖@angular/core和/或rxjs

type this:输入:

ng config -g cli

遇到同样的问题,但可以通过输入 1. npm link 然后输入 2. ng serve 来解决,如果您仍然遇到问题,请联系我...

暂无
暂无

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

相关问题 你似乎不依赖于“@ 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”. This is an error 您似乎并不依赖“@angular/core”。 打字稿 - You seem to not be depending on “@angular/core”. Typescript 您似乎不依赖于“ @ angular / core”和/或“ rxjs”。 这是一个错误 - You seem to not be depending on “@angular/core” and/or “rxjs”. This is an error Angular-CodeAnywhere-您似乎不依赖于“ @ angular / core”。 这是一个错误 - Angular - CodeAnywhere - You seem to not be depending on “@angular/core”. This is an error 您似乎不依赖“ @ angular / core”。 这是一个错误。 角项目 - You seem to not be depending on “@angular/core”. This is an error. Angular project 如何修复“你似乎不依赖于“@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 角度2:根据您所在的位置获取货币价值 - Angular 2 : obtain currency value depending on where you are 如何在angular2中为新的@ Angular /路由器获取RouteParams - 似乎不存在 - How in angular2 can you get RouteParams for the new @Angular/router - doesnt seem to exist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM