Tag Archives: vue.js

error in ./node_modules/@lit/reactive-element/decorators/state.jsModule parse failed: Unexpected

Recently developed an old project, I found that the project that was good before is now running an error, Various switching of npm sources and node versions does not work, Google did not find relevant information, The error is as follows:

 error  in ./node_modules/@lit/reactive-element/decorators/state.js

Module parse failed: Unexpected token (6:27)
You may need an appropriate loader to handle this file type.
|  * Copyright 2017 Google LLC
|  * SPDX-License-Identifier: BSD-3-Clause
|  */function t(t){return r({...t,state:!0})}export{t as state};
| //# sourceMappingURL=state.js.map

It says that the current file cannot be processed.

 error in ./node_modules/@lit/reactive-element/decorators/state.js

Module parse failed: Unexpected token (6:27)
You may need an appropriate loader to handle this file type.
| * Copyright 2017 Google LLC
| * SPDX-License-Identifier: BSD-3-Clause
| */function t(t){return r({...t,state:!0})}export{t as state};
| //# sourceMappingURL=state.js.map
| 

It is found that the file under the @lit module reports an error, click on the details and find that the source file here, is not es5 syntax.

Look at the version number in package.json, the ^ is used, which means that this module can be automatically minor version upgrade. Guess it should be that the module is automatically upgraded, causing some incompatibility so an error is reported,

Finally, I found that the project is configured with, babel parsing, this plugin outputs es6 code, needs to be compiled with bable.

 {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [
          [resolve('src'), resolve('/node_modules/_@lit')]
        ],
      }

See the error message is ./node_modules/@lit/reactive-element , the original path of the new version was changed to @lit,The old version is _@lit So there is no bable parsing, resulting in an error. After the following modification, a new parsing path has been added, The problem has been solved.

 {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [
          [resolve('src'), resolve('/node_modules/_@lit'), resolve('/node_modules/@lit') ]
        ],
      }

Can’t resolve ‘ansi-html-community’ & Cannot find module ‘is-docker (vuex-persistedstate Installed)

When the following error occurs in the console,it means that the plug-in is installed incorrectly

Can’t resolve ‘ansi-html-community’

Cannot find module ‘is-docker

Don’t use npm install

npm i vuex-persistedstate

But the environment you use is yarn, so you need to use yarn to install the plugin

yarn add vuex-persistedstate

Then the problem can be solved smoothly

Vue warn: duplicate keys detected: ‘1’. This may cause an update error

[VUE WARN]: Duplicate keys detected: ‘1’. This may cause an update error. :

/ font>


Problem description:


Reason analysis:
> Keys value binding problem
My problem is my problem when doing the project binding:

here my page rendering is based on id to apply colours to a drawing


Solution:


br>

The time of the time database displayed by the front end is inconsistent

These days I have encountered a huge pit. The time of data storage is 2 o ‘clock, but the time displayed on the front page is 16 o ‘clock, which is 14 hours short.
Describe the project background, the service is in the US, the project is a Mexican project, the database time and server time have been set to the Mexican time zone, but it is still not correct.
I have asked the project boss in the middle, and the boss gave me the opinion that the time zone was set on the URL of connecting data, but the front-end page was still not displayed correctly.
After several times of locating, the time to find it directly in the dev location will change. This is because the computer’s time zone is the Chinese time zone. But the time log is still on the server, the log time is correct. So guess the front-end is the time zone problem.
Because the last segment passes the timestamp, the timestamp has no time zone. So the front end also needs to change the time zone to correspond

  id : "crete_time",
		            renderer : function(idValue,value,record){
                        return value ?moment(value).tz("America/Guatemala").format("YYYY-MM-DD HH:mm:ss") : "---";
			        }

You can set the time zone using the Moment.tz method

Error: ~ /. Vuerc may be updated. Please delete it and re run vuercli in manual mode

Recently ready to develop an H5 sharing service, found the new version of Vue CLI4.0 is a lot of pit
First: My local @vue CLI version is 4.5.11:

 
Later, due to the tight schedule of the project, I directly reduced the local CLI version to 3.0, but because of my mistake, I made a mistake when creating the Vue project, but don’t worry:

Just find the local user directory C disk to find a.vuerc file deleted on the OK