[英]SchematicsException when creating an angular library with NX Commands
我將我的 NX 工作區更新到最新版本 ( "@nrwl/angular": "11.5.2"
),並在 monorepo 中將其與 Angular 應用程序 (v 11.2.6) 一起使用。
我想使用以下命令生成一個新的 Angular 庫:
ng generate @nrwl/angular:library --name=service --style=scss --directory=/libs/booking
但我在控制台中收到以下錯誤:
SchematicsException [Error]: Project name "-libs-booking-service" is not valid.
New project names must start with a letter, and must contain only alphanumeric
characters or dashes. When adding a dash the segment after the dash must also
start with a letter.
不知何故,該命令在項目名稱之前添加了一個-
,從而產生了錯誤。
我還清除了 node_modules 並再次重新安裝了軟件包,但沒有任何運氣。
更新
在 Shashank 的提示后,我將以下步驟留在幫助我解決問題的步驟:
如果我刪除目錄參數中的前導/
,我會收到以下錯誤:
ng generate @nrwl/angular:library --name=services --style=scss --directory=libs/booking
TypeError: Cannot read property 'paths' of undefined
這是由於 tsconfig.json 對於 NX 應該仍然是tsconfig.base.json
。 通過重命名它(暫時)該命令起作用。
根據您的評論,我認為以下命令對您有用。您的directory
有/libs/booking
,應該是libs/booking
ng generate @nrwl/workspace:library --name=service --style=scss --directory=libs/booking
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.