Error: ◈ Cannot read properties of undefined (reading 'name')

This error is popping up when I run ‘netlify dev’
◈ Cannot read properties of undefined (reading ‘name’)
I do not know what is looking for name.

AppName: gaiagardens

Build Logs:
npm run build

gaiagardens@1.0.0 build
netlify dev

(node:34805) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
◈ Netlify Dev ◈
◈ Injecting environment variable values for all scopes
◈ Ignored general context env var: LANG (defined in process)
◈ Ignored site settings env var: EMAIL_ADDRESS (defined in .env file)
◈ Injected .env file env var: EMAIL_ADDRESS
◈ Ignored site settings env var: EMAIL_PASSWORD (defined in .env file)
◈ Injected .env file env var: EMAIL_PASSWORD
◈ Ignored site settings env var: PORT (defined in .env file)
◈ Injected .env file env var: PORT
◈ Ignored site settings env var: SMTP_HOST (defined in .env file)
◈ Injected .env file env var: SMTP_HOST
◈ Ignored site settings env var: SMTP_PORT (defined in .env file)
◈ Injected .env file env var: SMTP_PORT
◈ Cannot read properties of undefined (reading ‘name’)

/netlify.toml
[functions]
external_node_modules = [“express”]
node_bundler = “esbuild”
[dev]
command = “node server.js”
/package.json
{
“name”: “gaiagardens”,
“version”: “1.0.0”,
“description”: “A custom website built for a client who specializes in sustainable landscaping.”,
“main”: “server.js”,
“scripts”: {
“start”: “nodemon server.js”,
“dev”: “node server.js”,
“test”: “echo "Error: no test specified" && exit 1”,
“build”: “netlify dev”,
“gulp”: “nodemon server.js”
},
“type”: “module”,
“keywords”: ,
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“dotenv”: “^16.4.5”,
“ejs”: “^3.1.10”,
“express”: “^4.19.2”,
“nodemailer”: “^6.9.13”,
“nodemon”: “^3.1.0”,
“serverless-http”: “^3.2.0”
},
“devDependencies”: {
“del”: “latest”,
“gulp”: “^5.0.0”,
“gulp-debug”: “^5.0.1”,
“gulp-ejs”: “^5.1.0”,
“gulp-htmlmin”: “^5.0.1”,
“gulp-imagemin”: “^9.1.0”,
“gulp-rename”: “^2.0.0”,
“gulp-replace”: “^1.1.4”,
“gulp-rimraf”: “^1.0.0”,
“gulp-size”: “^5.0.0”,
“netlify-cli”: “^17.23.5”
}
}

Thanks for your help.

1 Like

That could be a warning. Are you running into any issues due to it?

Thanks, hrishikesh.

The app stops running immediately after this warning.

I just wish I knew what the “name” was referring to.

Hi, @paulgasbarra. You cannot run netlify dev in the build system at Netlify. Well, technically you can but doing so isn’t supported in any way and won’t do anything useful.

Examining the repository for this site, it appears to depend on a Node.js application runtime. The only way to run Node.js code after the build at Netlify is via serverless functions:

However, the code in the GitHub repository for this site isn’t designed to use serverless functions and it is trying to use a Node.js server instead. Netlify doesn’t offer Node.js server hosting. That is Heroku style hosting and Netlify doesn’t provide this.

I encounter the same issue, however with a fresh local repository that has not been linked with anything remote.

It started with netlify-cli@17.23.3 (so 17.23.2 is fine), all the way to 17.25.0. I’ve tried various versions in between, all with the same problem.

It also happens when offline, but after a timeout. So:

npx netlify dev
◈ Netlify Dev ◈
◈ Injected netlify.toml file env var: NODE_ENV
◈ Ignored general context env var: LANG (defined in process)
◈ Cannot read properties of undefined (reading 'name')

The cause is specifically this line in netlify.toml:

[dev]
command = "anything here"

As in that block, anything can be there, it will cause this error. Removing it, and it all works again.

Could you share a reproduction repo? I tried adding the dev block but didn’t get an error in my test.

I’m having the same problem. (ntl v=17.25.0)
On this netlify project, I usually just run the ntl dev command to start the server. Without any changes to my code, I now get the error we’re talking about here, without the server.

C:\Users\me\Downloads\dev\si18n.js>ntl dev
◈ Netlify Dev ◈
◈ Injecting environment variable values for all scopes
◈ Ignored general context env var: LANG (defined in process)
◈ Cannot read properties of undefined (reading 'name')

C:\Users\me\Downloads\dev\si18n.js>

(Some other netlify projects work fine, and I have netlify-cli installed globally)

When I run ntl dev --debug, I got :

[project.ts]: detectFrameworks
[project.ts]: detectBuildSystem
[project.ts]: detectWorkspaces
[project.ts]: detectPackageManager
[project.ts]: detectFrameworksInPath - undefined

...
[project.ts]: getBuildSettings
[project.ts]: detectFrameworks
[get-build-settings.ts] getBuildSettings for baseDirectory:
◈ Cannot read properties of undefined (reading 'name')

So, I added the “framework” in the command (like this : netlify dev --framework="#static"), and now have the server running as expected.

1 Like

Thank you for the reproduction. I’ve let the devs know.

1 Like

I was able to get my site running by moving it over to Heroku. Thanks for the insight, Luke.