9

When I run npm start I get

ERROR  TypeError: Cannot read property 'version' of undefined
TypeError: Cannot read property 'version' of undefined

This happens after I have run

npm install

I tried to solve the issue by running npm -g install npm@version but instead it gave me this error

npm ERR! code ETARGET
npm ERR! notarget No matching version found for npm@version.
2
  • It seems to be npm versioning problem. Watch this: github.com/tjunnone/npm-check-updates/issues/608 Commented Jan 20, 2020 at 6:33
  • But when I check the logs am told {error code ELIFECYCLE} Commented Jan 20, 2020 at 6:38

2 Answers 2

9

Did you just upgrade your dependencies directly from 3.0? In v4 eslint is required as a dependency of the project itself. So npm install --save-dev eslint@4 may fix the warning.

Sign up to request clarification or add additional context in comments.

Comments

2

From my experience it may happen if there is import of package.json in one of your project's files, but with incorrect path.
Usually, some build related configurations use version property of the package.json.
It is hard to pinpoint the exact issue, since no specifics provided.
First, I'd search stack trace of the error to locate which file is requesting package.json. Global project search for .version should help to find the issue as well.

If you still unable to locate the issue, please, add full error stack trace.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.