Error creating project using vue-cli

the following error occurred when creating a project using vue-cli:

Command: vue create vue-hello

error report:

npm ERR! Unexpected end of JSON input while parsing near "...ant":"^2.2.2","semver"
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hope111/.npm/_logs/2018-05-27T08_16_41_717Z-debug.log
 ERROR  command failed: npm install --loglevel error --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/dist

error picture:

after searching on the Internet for a long time, I saw many people saying that they should know the cache of npm. Use the following instruction:

npm cache clean --force

but it didn"t work. If any of the seniors have encountered the same problem before or know how to solve it, please let me know, thank you!

Mar.28,2021

I have to answer this question, because it took me the whole day to get the previous json wrong and the last cammandfailed
to answer this question, just like yours. First of all, install the latest node,npm,vue3.0,vue-cli
if you have this problem, install cli-init and use npm init webpack [projectname] to create it with the old version, if you have to use the new version, Here are some of my attempts
first of all, my idea is that there may be something wrong with npm. I can't download
1.npm cache clean-- force = "failure
2. Change Taobao image = "failed
3. Change the original registry== "failed
4." Listen to the online npm downgraded to @ 4 = "failure
5." At this time, I opened the / Users/youname/.npm/_logs/2018-06-25T01_38_45_837Z-debug.log error file and found that every time the request for resources from Taobao domain failed to load 304( from cache), but the files obtained in other domains were 200ok.At the same time, the information related to Taobao image was also displayed in cammandfailed. I guess it was not deleted.
npm config registry clean
npm config disturl clean
enter / user / username/.npm at the same time to delete that Taobao folder (here I found that the cache.json in registry.cnpmjs.org is empty, but the cache.json in Taobao folder has content, that is, through npm cache clean-- force cannot be deleted, I can only try to delete it manually)
= "although the resources obtained in debug.log are 200, which is a success, unfortunately, Still report an error
6. At this time, I am a little desperate. What is the reason? Could it be vue, and then search it with google (yes, it was searched by Baidu before, du Niang misled my) vue creat project failure
came out https://github.com/vuejs/vue-. this thing
read carefully, it seems that many people have encountered problems, look directly at the bottom of the solution,
I am using "vue-cli 3.0.0-rc.1", I solve the problems by setting the ~ /. Vuerc from "useTaobaoRegistry": true, to false.
in the temple, this method is reliable by visual observation. Because at the beginning of debug.log
1 verbose cli ['/ usr/local/bin/node',
1 verbose cli'/ usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli'-loglevel',
1 verbose cli 'error',
1 verbose cli'-registry= https://registry.npm.taobao.org',
1 verbose cli'--disturl= https://npm.taobao.org/dist']
there is such a paragraph. The content behind debug.log shows that the package can be downloaded normally, and the final console error message is related to Taobao taobao.org, but my npm download has been set back to the original domain. It is likely that vue-cli is not aware of this guy and is fooling around for me.
modify ~ / .vuerc as mentioned above? = "solve the problem that vue create project can be used normally

it's not easy to play by hand. Please click on it before you go.


vue create myproject-r https://registry.npm.taobao.org


just execute the command directly


npmvue-cli vue-cli,

npm :

$ vue init

template-name 6 vuejs-templates:

  1. webpack - A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
  2. webpack-simple - A simple Webpack + vue-loader setup for quick prototyping.
  3. browserify - A full-featured Browserify + vueify setup with hot-reload, linting & unit testing.
  4. browserify-simple - A simple Browserify + vueify setup for quick prototyping.
  5. pwa - PWA template for vue-cli based on the webpack template
  6. simple - The simplest possible Vue setup in a single HTML file

:https://www.npmjs.com/package...



createalibabaeslint



I used yarn
to report an error: I couldn't find the Taobao source for yarn warehouse
and found that yarn
sudo npm i-g yarn

was not installed.

vue create my-app build vue project

.
$cd my-app
$yarn serve
so far, the project has been built successfully

Menu