When building a Pluggable widget I am missing all dependencies. No node_modules folder created.

1
I don't know if something has changed, but I can't create widget templates anymore with the yeoman command.   When running the ‘yo @mendix/widget’ command, only the source map is created. No node_modules folder is created and the ‘.yo-rc’ file is missing too. In the console when creating the widget template, these are the responses on the build:   File configuration done, now running npm install to install dependencies No change to package.json was detected. No package manager install will be executed. npm WARN config cache-min This option has been deprecated in favor of `--prefer-offline`. Dependencies should be installed using npm install before I can run the build using Pluggable Widgets Tools    Anybody knows what goes wrong or what I need to do? My version of nodejs = v16.16.0
asked
1 answers
0

You should check if you accidentally ran `npm install` in a parent directory of your project. You can see that by checking if there is a `node_modules` directory. If that’s the case, then NPM will detect that directory as the root of your project and install all modules there.

 

When there are no other `node_modules` directories in any parent directory of your project up to your home directory or filesystem root, then you should check if your `.npmrc` file has a line saying `location=global`. Delete that line if it is there, because it means any `npm install` command (including the one issued via Yeoman) will install modules in the global spot (probably in your home directory somewhere in a hidden subdirectory).

 

The NPM config can also be changed by executing `npm config get` (to check) and `npm config set global=false location=project` (to set).

answered