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

拈花ヽ惹草 提交于 2021-02-18 12:42:15

问题


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.

when I run ng serve i get the error: 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.

{
  "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"
}
}


回答1:


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.

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.

Another information from here

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 of npm or an antivirus.



来源:https://stackoverflow.com/questions/44187207/npm-install-is-building-cmd-files-in-my-angular-project-root-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!