简体   繁体   English

npm install 正在我的 angular 项目根目录中构建 .cmd 文件

[英]npm install is building .cmd files in my angular project root directory

I have a project that I've been working with for quite some time and it has built and compiled (and still does on a different machine) for months.我有一个项目,我已经使用了很长一段时间,它已经构建和编译(并且仍然在不同的机器上)数月。 Now, when I run the command npm install it runs as normal, but at the end of the process, it builds out tons of .cmd files (and another accompanying file) in the root folder of my project.现在,当我运行 npm install 命令时,它会正常运行,但在该过程结束时,它会在我的项目的根文件夹中生成大量 .cmd 文件(和另一个随附文件)。

when I run ng serve i get the error: Unknown browser query basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")当我运行 ng serve 时出现错误: Unknown browser query basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

I'm completely stumped as to how to get my project back to a usable and buildable state.我完全不知道如何让我的项目恢复到可用和可构建的状态。 Have never had problems with my angular builds like this.我的角度构建从来没有遇到过这样的问题。 Also my package.json file is below.我的 package.json 文件也在下面。

{
  "name": "project",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
 "private": true,
"dependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/animations": "^4.0.1",
"@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",
"angular2-notifications": "^0.7.4",
"core-js": "^2.4.1",
"pdfmake": "^0.1.28",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
 },
"devDependencies": {
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}

在此处输入图片说明

I face the same issue after changing my laptop domain and create a new user profile.更改我的笔记本电脑域并创建新的用户配置文件后,我面临同样的问题。

These files should be generated under node_modules/.bin folder.这些文件应该在node_modules/.bin文件夹下生成。

As a workaround, you can delete these files manually after each time you run npm install then run ng serve you should not see errors.作为一种解决方法,您可以在每次运行npm install后手动删除这些文件,然后运行ng serve您应该不会看到错误。

Another information from here来自这里的另一个信息

It looks like the contents of your node_modules/.bin/ folder are entirely pushed to your root folder.看起来您的node_modules/.bin/文件夹的内容已完全推送到您的根文件夹。 It might have to do with something installed on your computer, a config of npm or an antivirus.它可能与您计算机上安装的某些内容、 npm配置或防病毒软件有关。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM