npm install 正在我的 angular 项目根目录中构建 .cmd 文件 [英] npm install is building .cmd files in my angular project root directory
问题描述
我有一个项目,我已经使用了很长一段时间,它已经构建和编译(并且仍然在不同的机器上)数月.现在,当我运行 npm install 命令时,它会正常运行,但在该过程结束时,它会在我的项目的根文件夹中生成大量 .cmd 文件(和另一个随附文件).
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.
当我运行 ng serve 时出现错误:未知浏览器查询 basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
when I run ng serve i get the error:
Unknown browser query basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
我完全不知道如何让我的项目恢复到可用和可构建的状态.我的角度构建从来没有遇到过这样的问题.我的 package.json 文件也在下面.
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.
{
"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.
这些文件应该在node_modules/.bin
文件夹下生成.
These files should be generated under node_modules/.bin
folder.
作为一种解决方法,您可以在每次运行 npm install
后手动删除这些文件,然后运行 ng serve
您应该不会看到错误.
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.
来自此处
看起来你的 node_modules/.bin/
文件夹的内容是完全推送到您的根文件夹.这可能与安装在您的计算机上的东西,npm
的配置或防病毒软件.
It looks like the contents of your
node_modules/.bin/
folder are entirely pushed to your root folder. It might have to do with something installed on your computer, a config ofnpm
or an antivirus.
这篇关于npm install 正在我的 angular 项目根目录中构建 .cmd 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!