问题
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 ofnpm
or an antivirus.
来源:https://stackoverflow.com/questions/44187207/npm-install-is-building-cmd-files-in-my-angular-project-root-directory