Missing node error on "npm install" of custom node

When I do an npm command to install/update a custom node, I'm getting an error regarding a missing node. I created and installed the sample red-contrib-example-lower-case node. I have subsequently removed that node, but now it's giving an error on that node when I do an npm on my real node.

How do I get rid of that error?
TIA

npm WARN checkPermissions Missing write access to ~/node-red/node_modules/red-contrib-example-lower-case
npm WARN enoent ENOENT: no such file or directory, open '~/node-red/package.json'
npm WARN node-red No description
npm WARN node-red No repository field.
npm WARN node-red No README data
npm WARN node-red No license field.

npm ERR! code ENOENT
npm ERR! syscall access
npm ERR! path ~/node-red/node_modules/red-contrib-example-lower-case
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, access '~/node-red/node_modules/red-contrib-example-lower-case'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2021-02-19T15_40_56_881Z-debug.log

Welcome to the forum @jtaylor.
You appear to be running the command from the wrong folder, you should be in the .node-red folder.

So it should be ~/.node-red rather than node-red?

Edit:
I did that and I get the same error. This time the path is ~/.node-red/node_modules/red-contrib-example-lower-case.

1 Like

Can you post the full output please including the command you are entering.

Can you also post the output you get when you start node red in a terminal using node-red-start please.

-bash-4.4$ cd ~/.node-red
-bash-4.4$ npm install ~/node-red/dtaq-in
npm WARN checkPermissions Missing write access to ~/.node-red/node_modules/node-red-contrib-example-lower-case
npm ERR! code ENOENT
npm ERR! syscall access
npm ERR! path ~/.node-red/node_modules/node-red-contrib-example-lower-case
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, access '~/.node-red/node_modules/node-red-contrib-example-lower-case'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2021-02-19T20_57_29_301Z-debug.log

Where do I find node-red-start? I just start Node-RED via node_modules/node-red/red.js. It runs fine without issue, the only trouble is the false error during an npm install.

Usually that command is available after installing node red, assuming you followed the recommended method from the node red docs (depending on your OS). What OS are you using?

Post the output you get when starting node-red the way you usually do.

Edit. Also what happens if you try to install one of the contrib nodes from the command line?

OS is IBM i. I installed Node-RED using IBM-supplied documentation.

Here's the output from Node-RED startup (names have been changed to protect the innocent :wink:).

-bash-4.4$ ./node-red
19 Feb 15:05:37 - [info]

Welcome to Node-RED
===================

19 Feb 15:05:37 - [info] Node-RED version: v1.2.9
19 Feb 15:05:37 - [info] Node.js  version: v14.15.4
19 Feb 15:05:37 - [info] OS400 7.3 ppc64 BE
19 Feb 15:05:38 - [info] Loading palette nodes
19 Feb 15:05:40 - [info] Settings file  : ~/.node-red/settings.js
19 Feb 15:05:40 - [info] Context store  : 'default' [module=memory]
19 Feb 15:05:40 - [info] User directory : ~/.node-red
19 Feb 15:05:40 - [warn] Projects disabled : editorTheme.projects.enabled=false
19 Feb 15:05:40 - [info] Flows file     : ~/.node-red/flows_HOST.DOMAIN.COM.json
19 Feb 15:05:40 - [info] Server now running at http://127.0.0.1:1880/
19 Feb 15:05:40 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

19 Feb 15:05:40 - [info] Starting flows

OK, that's why the logs look unusual. Did you try installing another node? The purpose is to determine whether it is an issue with the custom node or whether something is confused in the system. So for example
npm install node-red-contrib-simple-gate

I can install other nodes just fine. In fact, the only symptom of a problem is the errors on that bad node during an npm install. I could just ignore it, but I'm afraid that in doing so I might miss real errors later.

Can you post the package.json from the custom node please you are trying to install, and also the file ~/.node-red/package.json. Does the folder ~/.node-red/node_modules/node-red-contrib-example-lower-case exist, and if so post what you see when you run
ls -al ~/.node-red/node_modules/node-red-contrib-example-lower-case

Here's the package.json, and the "smoking gun". How can I safely remove that bogus dependency?

{
    "name": "node-red-project",
    "description": "A Node-RED Project",
    "version": "0.0.1",
    "private": true,
    "dependencies": {
        "node-red-contrib-example-lower-case": "file:../node-red/sample-node"
    }
}

That folder is a broken symlink that points to "../../node-red/sample-node".

Ah, presumably you deleted that folder. Try
npm remove node-red-contrib-example-lower-case
If that doesn't work then you can delete the broken link and remove that line from package.json.

I deleted the broken symlink.
-bash-4.4$ ls -al ~/.node-red/node_modules/node-red-contrib-example-lower-case
ls: cannot access '~/.node-red/node_modules/node-red-contrib-example-lower-case': No such file or directory

I also removed it from ~/.node-red/package.json:

    "name": "node-red-project",
    "description": "A Node-RED Project",
    "version": "0.0.1",
    "private": true,
    "dependencies": {
    }
}

I'm still getting the errors when I do an npm install.

Is it possible to save off the flows I've created? If so, I think it would be easier just to completely delete my test Node-RED and reinstall it.

Of course, you just have to keep a copy of your flows file. It tells you which file that is when you start node red.

If you want to start again then rename the .node-red folder and restart node red. That will create a new folder and start with an empty flow file. I suggest then trying to install and test your node. When you have got it working then replace your flows file with the old one and restart node red.
Don't forget to refresh the browser when you restart node red.

1 Like

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