背景
使用angular初始化工程,angular new ng-app
問題現象
命令行報錯resource busy or locked
處理過程
根據報錯信息發現是和node gyp有關,查了下,瞭解到gyp是用來編譯C++相關庫的。根據node-gyp中的說明,下載visual studio(實際下載的是2019版本的),並安裝,然後設置npm config set msvs_version 2019
。
然後再次運行angular new ng-app
正常了。
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE ng-app-test/angular.json (3069 bytes)
CREATE ng-app-test/package.json (1082 bytes)
CREATE ng-app-test/README.md (1055 bytes)
CREATE ng-app-test/tsconfig.json (783 bytes)
CREATE ng-app-test/.editorconfig (274 bytes)
CREATE ng-app-test/.gitignore (604 bytes)
CREATE ng-app-test/.browserslistrc (703 bytes)
CREATE ng-app-test/karma.conf.js (1428 bytes)
CREATE ng-app-test/tsconfig.app.json (287 bytes)
CREATE ng-app-test/tsconfig.spec.json (333 bytes)
CREATE ng-app-test/src/favicon.ico (948 bytes)
CREATE ng-app-test/src/index.html (295 bytes)
CREATE ng-app-test/src/main.ts (372 bytes)
CREATE ng-app-test/src/polyfills.ts (2820 bytes)
CREATE ng-app-test/src/styles.css (80 bytes)
CREATE ng-app-test/src/test.ts (743 bytes)
CREATE ng-app-test/src/assets/.gitkeep (0 bytes)
CREATE ng-app-test/src/environments/environment.prod.ts (51 bytes)
CREATE ng-app-test/src/environments/environment.ts (658 bytes)
CREATE ng-app-test/src/app/app-routing.module.ts (245 bytes)
CREATE ng-app-test/src/app/app.module.ts (393 bytes)
CREATE ng-app-test/src/app/app.component.html (24617 bytes)
CREATE ng-app-test/src/app/app.component.spec.ts (1088 bytes)
CREATE ng-app-test/src/app/app.component.ts (215 bytes)
CREATE ng-app-test/src/app/app.component.css (0 bytes)
√ Packages installed successfully.
Successfully initialized git.