Vue-cli: Running vue-cli-service fails with an exception "Cannot read property 'replace' of null"

Created on 7 Jul 2018  路  5Comments  路  Source: vuejs/vue-cli

Version

3.0.0-rc.3

Reproduction link

https://github.com/jaromero/vue-cli-service-error-demo

Steps to reproduce

  1. vue create my-app
  2. Select any options you want and let the project be created
  3. cd my-app && yarn run serve (or npm if chosen)
  4. Try running any vue-cli-service command, like npx vue-cli-service serve

What is expected?

No errors; vue-cli-service should run as expected.

What is actually happening?

When vue-cli-service is run with npx, the output is simply:

Cannot read property 'replace' of null

With yarn, the output is:

~~~
yarn run v1.7.0
$ vue-cli-service serve
/home/nsdragon/test/vue-cli/my-app/node_modules/hosted-git-info/index.js:73
if (!(ex instanceof URIError)) throw ex
^

TypeError: Cannot read property 'replace' of null
at /home/nsdragon/test/vue-cli/my-app/node_modules/hosted-git-info/index.js:61:63
at Array.map ()
at fromUrl (/home/nsdragon/test/vue-cli/my-app/node_modules/hosted-git-info/index.js:45:39)
at Function.module.exports.fromUrl (/home/nsdragon/test/vue-cli/my-app/node_modules/hosted-git-info/index.js:32:18)
at Object. (/home/nsdragon/test/vue-cli/my-app/node_modules/normalize-package-data/lib/fixer.js:150:36)
at Array.forEach ()
at Object. (/home/nsdragon/test/vue-cli/my-app/node_modules/normalize-package-data/lib/fixer.js:144:31)
at Array.forEach ()
at Object.fixDependencies (/home/nsdragon/test/vue-cli/my-app/node_modules/normalize-package-data/lib/fixer.js:137:41)
at /home/nsdragon/test/vue-cli/my-app/node_modules/normalize-package-data/lib/normalize.js:32:38
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
~~~

(npm shows largely the same information, plus npm-specific info like this is not a problem with npm, debug log at /path/to/wherever/debug.log etc.)

Even with pnpm (and installing dependencies with the --shamefully-flatten flag) this fails and produces the same error as npm.


Node: 10.6.0
npm: 6.1.0
yarn: 1.7.0

upstream

Most helpful comment

Looks like this was an issue with hosted-git-info, and they just merged a quick fix an hour ago.

https://github.com/npm/hosted-git-info/issues/35

Updating hosted-git-info resolved the issue for me

All 5 comments

I've got the same error.

Same, getting this on two different Windows computers

Looks like this was an issue with hosted-git-info, and they just merged a quick fix an hour ago.

https://github.com/npm/hosted-git-info/issues/35

Updating hosted-git-info resolved the issue for me

@chasebank Thanks, worked for me too.

We'll leave this open for a while so people with the same problem find this info more easily, but this could be closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandon93s picture brandon93s  路  3Comments

sanderswang picture sanderswang  路  3Comments

eladcandroid picture eladcandroid  路  3Comments

jgribonvald picture jgribonvald  路  3Comments

NathanKleekamp picture NathanKleekamp  路  3Comments