azure-func-http icon indicating copy to clipboard operation
azure-func-http copied to clipboard

Schematics fail without install dependencies

Open caenguidanos opened this issue 5 years ago โ€ข 21 comments

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Schematics fail. You need to install manually npm i @nestjs/azure-func-http and then add schematics with nest add @nestjs/azure-func-http.

Expected behavior

Automatically install necessary dependencies.

Minimal reproduction of the problem with instructions

nest add @nestjs/azure-func-http

What is the motivation / use case for changing the behavior?

Comodity

Environment


Nest version: 7.0.0

 
For Tooling issues:
- Node version: 12.18.3  
- Platform:  Linux 

Others:

Thanks for your work,

caenguidanos avatar Sep 13 '20 22:09 caenguidanos

Would you be able to share some logs (errors you faced)?

kamilmysliwiec avatar Sep 14 '20 06:09 kamilmysliwiec

New project:

nest new api
nest add @nestjs/azure-func-http

Out:

Error: Collection "@nestjs/azure-func-http" cannot be resolved.
    at NodeModulesEngineHost.resolve (/home/cenguidanos/Desktop/api/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:75:19)
    at NodeModulesEngineHost._resolveCollectionPath (/home/cenguidanos/Desktop/api/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:80:37)
    at NodeModulesEngineHost.createCollectionDescription (/home/cenguidanos/Desktop/api/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:110:27)
    at SchematicEngine._createCollectionDescription (/home/cenguidanos/Desktop/api/node_modules/@angular-devkit/schematics/src/engine/engine.js:148:40)
    at SchematicEngine.createCollection (/home/cenguidanos/Desktop/api/node_modules/@angular-devkit/schematics/src/engine/engine.js:141:43)
    at NodeWorkflow.execute (/home/cenguidanos/Desktop/api/node_modules/@angular-devkit/schematics/src/workflow/base.js:101:41)
    at main (/home/cenguidanos/Desktop/api/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:223:24)
    at Object.<anonymous> (/home/cenguidanos/Desktop/api/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:314:5)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)

Failed to execute command: "/home/cenguidanos/Desktop/api/node_modules/@nestjs/cli/node_modules/.bin/schematics" @nestjs/azure-func-http:nest-add --sourceRoot="src" /usr/bin/node /usr/bin/nest add @nestjs/azure-func-http

If previously install:

nest new api
yarn add @nestjs/azure-func-http
nest add @nestjs/azure-func-http

Works fine:

โœ” Package installation in progress... โ˜•
Starting library setup...
CREATE .funcignore (66 bytes)
CREATE host.json (23 bytes)
CREATE local.settings.json (116 bytes)
CREATE proxies.json (72 bytes)
CREATE main/function.json (294 bytes)
CREATE main/index.ts (287 bytes)
CREATE main/sample.dat (23 bytes)
CREATE src/main.azure.ts (321 bytes)
UPDATE package.json (2014 bytes)
โœ” Packages installed successfully.

caenguidanos avatar Sep 14 '20 13:09 caenguidanos

I have the same problem. Manual installation works

markusheinemann avatar Oct 22 '20 20:10 markusheinemann

have same problem, here's logs:

personal/blink [nestjs] ยป nest add @nestjs/azure-func-http
โœ” Package installation in progress... โ˜•
Starting library setup...
Error: Collection "@nestjs/azure-func-http" cannot be resolved.
    at NodeModulesEngineHost.resolve (/Users/dmytro/Work/personal/blink/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:75:19)
    at NodeModulesEngineHost._resolveCollectionPath (/Users/dmytro/Work/personal/blink/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:80:37)
    at NodeModulesEngineHost.createCollectionDescription (/Users/dmytro/Work/personal/blink/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:118:27)
    at SchematicEngine._createCollectionDescription (/Users/dmytro/Work/personal/blink/node_modules/@angular-devkit/schematics/src/engine/engine.js:162:40)
    at SchematicEngine.createCollection (/Users/dmytro/Work/personal/blink/node_modules/@angular-devkit/schematics/src/engine/engine.js:155:43)
    at NodeWorkflow.execute (/Users/dmytro/Work/personal/blink/node_modules/@angular-devkit/schematics/src/workflow/base.js:101:41)
    at main (/Users/dmytro/Work/personal/blink/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:260:14)
    at Object.<anonymous> (/Users/dmytro/Work/personal/blink/node_modules/@angular-devkit/schematics-cli/bin/schematics.js:370:5)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)

Failed to execute command: node @nestjs/azure-func-http:nest-add --sourceRoot="src" /usr/local/bin/node /usr/local/bin/nest add @nestjs/azure-func-http
^C

sinnrrr avatar Jan 09 '22 17:01 sinnrrr

Same here using pnpm, I got it to work removing node_modules and pnpm-lock.yaml and running nest add @nestjs/azure-func-http but it uses npm not pnpm, but it works.

diegoazh avatar Apr 18 '22 15:04 diegoazh

The issue is happening because the azure-func-http package is only compatible with the nest cli versions ^6.0.0, ^7.0.0 or ^8.0.0". the ^9.0.0 version of nest was released 4 months ago. The following workaround fixed my issue.

  1. uninstall the @nestjs/cli package globally/locally
  2. npm install -g @nestjs/[email protected] (8.2.8 is the latest version 8 of the nest cli)
  3. nest new
  4. nest add @nestjs/azure-func-http

didieryemalin avatar Nov 02 '22 17:11 didieryemalin

Thanks @didieryemalin that's worked!

andersonmorony avatar Nov 23 '22 13:11 andersonmorony

Is this now resolved with v9 support?

kkikta-bcg avatar Feb 10 '23 19:02 kkikta-bcg

please can someone answer @kkikta-bcg ?

phemidawhiz avatar Feb 11 '23 10:02 phemidawhiz

In case it helps anyone: I had to downgrade @schematics/angular:

npm i @schematics/angular@^13.0.0

ceuk avatar Mar 29 '23 11:03 ceuk

Another pnpm user here, found another workaround without downgrading anything:

pnpm add @nestjs/azure-func-http
pnpm add @azure/functions
pnpm add @schematics/angular
nest add @nestjs/azure-func-http

This finally gives this output:

โœ” Package installation in progress... โ˜•
Starting library setup...
CREATE .funcignore (66 bytes)
CREATE host.json (23 bytes)
CREATE local.settings.json (116 bytes)
CREATE proxies.json (72 bytes)
CREATE main/function.json (294 bytes)
CREATE main/index.ts (287 bytes)
CREATE main/sample.dat (23 bytes)
CREATE src/main.azure.ts (321 bytes)
UPDATE package.json (2109 bytes)
โœ” Packages installed successfully.

Not sure why those steps were necessary, but i just noticed that all those libraries were present in the package.json but missing in the node_modules ... perhaps a bug on pnpm side ?

davidonlaptop avatar Apr 15 '23 17:04 davidonlaptop

@davidonlaptop's solution is what worked for me.

jrhager84 avatar Jul 30 '23 23:07 jrhager84

Another pnpm user here, found another workaround without downgrading anything:

pnpm add @nestjs/azure-func-http
pnpm add @azure/functions
pnpm add @schematics/angular
nest add @nestjs/azure-func-http

This finally gives this output:

โœ” Package installation in progress... โ˜•
Starting library setup...
CREATE .funcignore (66 bytes)
CREATE host.json (23 bytes)
CREATE local.settings.json (116 bytes)
CREATE proxies.json (72 bytes)
CREATE main/function.json (294 bytes)
CREATE main/index.ts (287 bytes)
CREATE main/sample.dat (23 bytes)
CREATE src/main.azure.ts (321 bytes)
UPDATE package.json (2109 bytes)
โœ” Packages installed successfully.

Not sure why those steps were necessary, but i just noticed that all those libraries were present in the package.json but missing in the node_modules ... perhaps a bug on pnpm side ?

Thanks mate, this also worked for yarn.

Notaduck avatar Jul 31 '23 10:07 Notaduck

@davidonlaptop thanks !! IT WORK

salim4n avatar Sep 29 '23 11:09 salim4n

In case it helps anyone: I had to downgrade @schematics/angular:

npm i @schematics/angular@^13.0.0

this works for me

Gabriel3421 avatar Oct 10 '23 14:10 Gabriel3421

is this package maintained? the problem still exist, on v9 and on v10 of cli

staszewski avatar Oct 19 '23 07:10 staszewski

In case it helps anyone: I had to downgrade @schematics/angular:

npm i @schematics/angular@^13.0.0

this work!

HiroForYou avatar Oct 24 '23 14:10 HiroForYou

$ nest add @nestjs/azure-func-http โœ” Package installation in progress... โ˜• Starting library setup... Error: Cannot find module '@schematics/angular/utility/dependencies' Require stack:

  • C:\udhaya\azure-function\triggerfunction\check\node_modules@nestjs\azure-func-http\schematics\install\index.js
  • C:\udhaya\azure-function\triggerfunction\check\node_modules@angular-devkit\schematics\tools\export-ref.js
  • C:\udhaya\azure-function\triggerfunction\check\node_modules@angular-devkit\schematics\tools\index.js
  • C:\udhaya\azure-function\triggerfunction\check\node_modules@angular-devkit\schematics-cli\bin\schematics.js

Failed to execute command: node @nestjs/azure-func-http:nest-add --source-root="src" C:\Program Files\nodejs\node.exe C:\Users\LENOVO\AppData\Roaming\npm\node_modules@nestjs\cli\bin\nest.js add @nestjs/azure-func-http

i got these issue

udhayaPoco avatar Mar 14 '24 01:03 udhayaPoco

In case it helps anyone: I had to downgrade @schematics/angular:

npm i @schematics/angular@^13.0.0

This works to me. Thank your so much :)

codex78 avatar May 01 '24 01:05 codex78