Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on vue create command #4732

Open
Jabark opened this issue Oct 21, 2019 · 14 comments · Fixed by #4741
Open

Error on vue create command #4732

Jabark opened this issue Oct 21, 2019 · 14 comments · Fixed by #4741

Comments

@Jabark
Copy link

Jabark commented Oct 21, 2019

Version

4.0.4

Environment info

Environment Info:

  System:
    OS: Windows 10
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 8.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 41.16299.1419.0
  npmGlobalPackages:
    @vue/cli: Not Found
Environment Info:

  System:
    OS: Windows 10
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 10.15.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 41.16299.1419.0
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

  • Using either 10.15.3 or 8.12.0 versions of Node (windows nvm), run nvm install -g @vue/cli.
  • Run vue create hello-vue -d
  • Error happens

What is expected?

The command is successful

What is actually happening?

 ERROR  SyntaxError: Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at PackageManager.getMetadata (C:\Users\C21869A\AppData\Roaming\nvm\v8.12.0\node_modules\@vue\cli\lib\util\ProjectPackageManager.js:149:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

This is my first time trying out vue. I also tried using a different registry but got the same issue.

@Jabark
Copy link
Author

Jabark commented Oct 21, 2019

Also worth noting that I've downgraded to version 3.12.1 and I don't get this issue there at all.

@Jabark
Copy link
Author

Jabark commented Oct 21, 2019

Something of further interest, I just thought I'd try going back to version 4.0.4 and using -m npm in the command. Still seemingly got the error but it did run through and create it:

Vue CLI v4.0.4
✨  Creating project in C:\Users\C21869A\git-repos\vue-getting-started\hello-vue-4.
🗃  Initializing git repository...
⚙  Installing CLI plugins. This might take a while...

(node:24744) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at PackageManager.getMetadata (C:\Users\C21869A\AppData\Roaming\nvm\v10.15.3\node_modules\@vue\cli\lib\util\ProjectPackageManager.js:149:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:24744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting
a promise which was not handled with .catch(). (rejection id: 1)
(node:24744) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

> yorkie@2.0.0 install C:\Users\C21869A\git-repos\vue-getting-started\hello-vue-4\node_modules\yorkie
> node bin/install.js

setting up Git hooks
done


> core-js@3.3.2 postinstall C:\Users\C21869A\git-repos\vue-getting-started\hello-vue-4\node_modules\core-js
> node postinstall || echo "ignore"


> core-js-pure@3.3.2 postinstall C:\Users\C21869A\git-repos\vue-getting-started\hello-vue-4\node_modules\core-js-pure
> node postinstall || echo "ignore"

added 1129 packages from 826 contributors in 92.345s
🚀  Invoking generators...
📦  Installing additional dependencies...

added 56 packages from 44 contributors in 29.281s
⚓  Running completion hooks...

📄  Generating README.md...

🎉  Successfully created project hello-vue-4.
👉  Get started with the following commands:

 $ cd hello-vue-4
 $ npm run serve

@sodatea
Copy link
Member

sodatea commented Oct 21, 2019

So according to the output, the error is raised when parsing the result of yarn info vue-cli-version-marker --json.
Could you try to execute this command in your terminal and see if it successfully returns? It's usually a network according to my experience.

@Jabark
Copy link
Author

Jabark commented Oct 21, 2019

$ yarn info vue-cli-version-marker --json
{"type":"error","data":"Received invalid response from npm."}

@Jabark
Copy link
Author

Jabark commented Oct 21, 2019

$ yarn info vue-cli-version-marker --json --verbose
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\git-repos\\\\vue-getting-started\\\\.npmrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\.npmrc\"."}
{"type":"verbose","data":"Found configuration file \"C:\\\\Users\\\\C21869A\\\\.npmrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Program Files\\\\nodejs\\\\etc\\\\npmrc\"."}
{"type":"verbose","data":"Found configuration file \"C:\\\\Program Files\\\\nodejs\\\\etc\\\\npmrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\git-repos\\\\vue-getting-started\\\\.npmrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\git-repos\\\\.npmrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\.npmrc\"."}
{"type":"verbose","data":"Found configuration file \"C:\\\\Users\\\\C21869A\\\\.npmrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\.npmrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\git-repos\\\\vue-getting-started\\\\.yarnrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\.yarnrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Program Files\\\\nodejs\\\\etc\\\\yarnrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\git-repos\\\\vue-getting-started\\\\.yarnrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\git-repos\\\\.yarnrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\C21869A\\\\.yarnrc\"."}
{"type":"verbose","data":"Checking for configuration file \"C:\\\\Users\\\\.yarnrc\"."}
{"type":"verbose","data":"current time: 2019-10-21T15:13:57.647Z"}
{"type":"verbose","data":"Performing \"GET\" request to \"https://artifactory.of.our.company.local/artifactory/api/npm/admin-portal/vue-cli-version-marker\"."}
{"type":"error","data":"Received invalid response from npm."}

@mathworld
Copy link

Same here, node 10.16.3, npx --package @vue/cli vue 4.0.4. Using WebStorm to create the project, fails with: /Users/xyz/.nvm/versions/node/v10.16.3/bin/node /Users/xyz/.nvm/versions/node/v10.16.3/lib/node_modules/npm/bin/npx-cli.js --package @vue/cli vue create .
ERROR SyntaxError: Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at PackageManager.getMetadata (/Users/xyz/.npm/_npx/8191/lib/node_modules/@vue/cli/lib/util/ProjectPackageManager.js:149:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
Done

Any help appreciated, thanks

@allan-christian
Copy link

I'm having the same issue using vue ui to create a project. If I try to create it via command line:

vue create vue-ui --skipGetStarted --packageManager npm --force --no-git --inlinePreset {"useConfigFiles":false,"plugins":{"@vue/cli-plugin-babel":{},"@vue/cli-plugin-router":{"historyMode":true},"@vue/cli-plugin-vuex":{},"@vue/cli-plugin-eslint":{"config":"standard","lintOn":["save"]}},"cssPreprocessor":"node-sass"}

I got the following error:

zsh: no matches found: plugins:@vue/cli-plugin-eslint:lintOn:[save]

@sodatea
Copy link
Member

sodatea commented Oct 22, 2019

So the problem is that your company's internal npm registry does not support yarn info or npm info, thus the version check throws.
That should be fixed on the registry side. Though, we can have a fallback logic in the CLI. And since the version check is not critical, the error should be catched.

@sodatea
Copy link
Member

sodatea commented Oct 22, 2019

@allan-christian Wrap the JSON in a pair of quotation marks.

vue create vue-ui --skipGetStarted --packageManager npm --force --no-git --inlinePreset '{"useConfigFiles":false,"plugins":{"@vue/cli-plugin-babel":{},"@vue/cli-plugin-router":{"historyMode":true},"@vue/cli-plugin-vuex":{},"@vue/cli-plugin-eslint":{"config":"standard","lintOn":["save"]}},"cssPreprocessor":"node-sass"}'

@Jabark
Copy link
Author

Jabark commented Oct 22, 2019

So the problem is that your company's internal npm registry does not support yarn info or npm info, thus the version check throws.
That should be fixed on the registry side. Though, we can have a fallback logic in the CLI. And since the version check is not critical, the error should be catched.

Not sure what you mean. Seems to work fine:

$ npm info software-ui-saas-library

software-ui-saas-library@18.9.0 | LicenseRef-LICENSE | deps: 19 | versions: 77
Common component/service library for SaaS Portal UI

dist
.tarball: https://artifactory.of.our.company.local/artifactory/api/npm/admin-portal/software-ui-saas-library/-/software-ui-saas-library-18.9.0.tgz
.shasum: 07d68e122911680d9642e6d0ef34fb522b2c84d2

dependencies:
@angular/animations: ^7.2.15               angular2-uuid: 1.1.1
@angular/common: ^7.2.15                   flat: 4.1.0
@angular/compiler: ^7.2.15                 moment-timezone: ^0.5.26
@angular/core: ^7.2.15                     moment: ^2.24.0
@angular/forms: ^7.2.15                    ng2-cookies: 1.0.12
@angular/platform-browser-dynamic: ^7.2.15 roboto-fontface: 0.7.0
@angular/platform-browser: ^7.2.15         rxjs: ^6.5.3
@angular/router: ^7.2.15                   tslib: ^1.9.0
@types/flat: 0.0.28                        zone.js: ^0.8.29
@types/moment-timezone: ^0.5.12

dist-tags:
latest: 18.9.0

published a week ago
$ npm info moment

moment@2.24.0 | MIT | deps: none | versions: 62
Parse, validate, manipulate, and display dates
http://momentjs.com

keywords: moment, date, time, parse, format, validate, i18n, l10n, ender

dist
.tarball: https://artifactory.of.our.company.local/artifactory/api/npm/admin-portal/moment/-/moment-2.24.0.tgz
.shasum: 0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b

maintainers:
- ichernev <iskren.chernev@gmail.com>
- maggiepint <maggiepint@gmail.com>
- marwahaha <marwahaha@berkeley.edu>
- mj1856 <mj1856@hotmail.com>
- timrwood <washwithcare@gmail.com>

dist-tags:
latest: 2.24.0

published 9 months ago by marwahaha <marwahaha@berkeley.edu>

@sodatea
Copy link
Member

sodatea commented Oct 22, 2019

That explains why -m npm worked.
But no idea why there's still error messages.

@Jabark
Copy link
Author

Jabark commented Oct 22, 2019

Actually seems to be because vue-cli-version-marker doesn't exist in our artifactory. Will investigate why this is the case.

@Jabark
Copy link
Author

Jabark commented Oct 22, 2019

So it seems our virtual repo goes to get packages from the remote when you run npm install, but not upon npm info.

@sodatea
Copy link
Member

sodatea commented Oct 22, 2019

Partially fixed in v4.0.5.
Reopen because the current fix in the PR does not fully resolve this issue.
We need to implement a fallback mechanism to initiate HTTP requests directly to the official registry.

@sodatea sodatea reopened this Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants