Node with text input not installing

I'm trying to create a node that simply takes a text input (phone number) and outputs it as msg.number. I can't seem to get the node to show up in Node-Red.
It says it installed successfully. I'm a noob so it's quite possible there are many things wrong with this.

+ node-red-contrib-phone-number@1.0.0
added 1 package and audited 133 packages in 41.445s

js file

module.exports = function(RED) {
    function Phone-NumberNode(config) {
        var node = this;
        node.on('input', function(msg) {
            msg.number = n.number;

html file

<script type="text/javascript">
        category: 'function',
        color: '#a6bbcf',
        defaults: {
            name: {value:"phone-number"}
        icon: "",
        label: function() {
<script type="text/x-red" data-template-name="phone-number">
    <div class="form-row">
        <label for="node-input-name"><i class="icon-tag"></i>Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    <div class="form-row">
        <label for="node-input-number"><i class="icon-tag"></i>Number</label>
        <input type="text" id="node-input-number" placeholder="17801234567">
<type="text/x-red" data-help-name="charcount">
    <p>Enter Phone Number</p>


  "name": "node-red-contrib-phone-number",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "author": "",
  "license": "ISC",
  "node-red" : {
        "nodes": {
            "phone-number": "phone-number.js"

What directory were you in when you ran the npm install?

Did you restart Node-RED after installing it?

Does the Node-RED log show any errors related to your node on startup?

Node-RED logs the user directory it is using on startup - that is the directory you should install the node in.

Directory was ./node-red
No errors

Found the error in node-red startup
16 Apr 17:53:17 - [warn] [node-red-contrib-phone-number/phone-number] SyntaxError: Unexpected token '-' (line:2)

I'm sure you have now spotted the issue. However, are you using a proper editor like VSCODE? It would have highlighted this issue well before you attempted to install it.

Thanks, I did see that and got it to install

Could you point me in the right direction for referencing my number input in the javascript function?

Your function is ok. You are missing the default for your variable...

Read the docs on creating your first node.

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