NX ERROR - Nx failed to install dependencies
Asked Answered
H

6

5

I'm not sure what could be going wrong and the error message is blank whenever I open it. I've searched online for fixes but nothing has helped hence I'm asking here.

My version of node is: v16.1.0 My version of npm: 8.1.3

And I'm currently running Monterey OS on my M1 MacBook.

khalidn@Khalids-MacBook-Air Next % npx create-nx-workspace --preset=next
✔ Workspace name (e.g., org name)     · km
✔ Application name                    · site
✔ Default stylesheet format           · css
✔ Use Nx Cloud? (It's free and doesn't require registration.) · No

>  NX  Nx is creating your workspace.

  To make sure the command works reliably in all environments, and that the preset is applied correctly,
  Nx will run "npm install" several times. Please wait.

✖ Installing dependencies with npm

>  NX   ERROR  Nx failed to install dependencies

  Exit code: 1
  Log file: /var/folders/vk/k0pds4vn1cb7wf1jvbhdj79w0000gn/T/tmp-46552-0zjGtpc1VjRl/error.log

Has anyone else gone through this?

Howlyn answered 7/11, 2021 at 15:5 Comment(4)
Same problem here, it seems to be failing when building the @parcel/watcher package. (M1 Monterrey, Node 16.6.1, Yarn 1.22.17)Heelandtoe
Were you able to find a solution?Howlyn
same her, it took almost hour and pop up that message.Papilla
@Heelandtoe how did you fix this? Facing same issue.Callus
H
4

Alright I looked into it and the problem occurs when the full path to your nx repo has spaces in it.

Looking through the log that is generated the make compiler complains that a folder is missing and its due to the fact that its looking for that folder in the partial path.

I am not sure who is responsible for fixing this issue but the workaround would be to make sure your path to the nx repo does not have any spaces in it!

Heelandtoe answered 11/11, 2021 at 17:33 Comment(1)
thank you , this work for me. you guys should try this too.Papilla
P
3

What worked for me is to use version @13.9.3 instead of @latest.

npx [email protected]
Plowshare answered 13/5, 2022 at 23:39 Comment(0)
H
2

Try if you are using private registry. I faced the same issue.

My issue resolution was to configure .npmrc in such a way that it should fetch public packages from public npm registry and other private package from our private registry.

registry=https://registry.npmjs.org/ 

@privatePackage:registry=https://registry.private.dev/
Hamlin answered 28/6, 2022 at 7:32 Comment(0)
R
1

the shortest way that work for me is deleting nx cache folder

enter image description here https://i.sstatic.net/JqpWnf2C.png

i stambled on this error too often(after upgrading to nx 18.2.0) for cleaning npm cache and npm intall. and this trick is the fastest

Redfaced answered 29/4, 2024 at 15:8 Comment(0)
H
0

I was able to get it to work by installing it this way in the terminal:

npx create-nx-workspace [workspace name] \
--preset=next \
--style=css \
--appName=[app name]
Howlyn answered 11/11, 2021 at 9:45 Comment(0)
H
0

On a Mac, this worked for me:

npm uninstall @nrwl/schematics; npm install -g @nrwl/schematics npm cache clean --force;npx create-nx-workspace@latest
Hemihedral answered 18/12, 2021 at 19:55 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.