Npm install local-directory no longer makes symbolic links

For a long time I've been running npm install some-local-directory from ~/.node-red, which creates a symbolic link to some-local-directory where I'm doing my node development. With npm 9.4.0 (companion to nodejs 19.6.1) this is no longer the case; it looks like a plain copy is done instead. Therefore changes in some-local-directory have no effect on a restarted node-red.

As a work around, I've installed an older nodejs/npm version with nvm. The previous behaviour has been restored and my development workflow works again.

Does anyone know a better long term solution to the new npm behaviour?

chris

I think the better workaround might be to use one of the supported versions of nodejs that are supported by node red (18 for example). Then wait and see what the next LTS version brings. That change could be reverted.

As Colin says, don't use odd numbered node.js versions and the npm versions that come with them since they often break things and breaking changes don't always end up landing in the next stable release.

That is the case here. There was indeed a change that meant that npm install on a local package installed a copy (which is also what a normal install does) rather than a pointer to the actual folder.

This broke several things and has been reversed.

NPM 9 update in 18.14.0 broke npm ci with local dependencies · Issue #46542 · nodejs/node (github.com),
NPM 9 update in 18.14.0 broke npm ci with local dependencies · Issue #46542 · nodejs/node (github.com)

BTW, a local install doesn't create a link, that's what npm link does. It actually references the local folder. In the past I had a lot of issues with npm link, at least on Windows, as it did some very strange double linking.

OK thank you all.

Interesting that NodeJS 18, an LTS, contains NPM 9 - an odd numbered (non-LTS?) version. Anyway, I just tried the same thing with 18.14.2 and that seems to have worked OK.

npm doesn't follow quite the same odd/even numbering that node.js does. The two are separately managed projects.

The currently stable version of npm is v9.

You would have hit the same issue if you were running Node.js 18.14.0.

If you read through the history of the issue linked above, this was an intended change in behaviour that had a wider than expected impact, so they reverted.

:ok: thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.