Tag Archives: View.js

Vue Install less Error: While resolving: [email protected]

Vue Install  less Error: While resolving: [email protected]

F:\Workspace\project\hhhs\wudslyh5\big-data\hblvbigdata>npm install less less-loader --save-dev
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.0.0" from @intervolga/[email protected]
npm ERR!   node_modules/@intervolga/optimize-cssnano-plugin
npm ERR!     @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/[email protected]
npm ERR!     node_modules/@vue/cli-service
npm ERR!       peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/[email protected]
npm ERR!       node_modules/@vue/cli-plugin-babel
npm ERR!         dev @vue/cli-plugin-babel@"~4.5.0" from the root project
npm ERR!       4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...)
npm ERR!   peer webpack@"^4.0.0 || ^5.0.0" from @soda/[email protected]
npm ERR!   node_modules/@soda/friendly-errors-webpack-plugin
npm ERR!     @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/[email protected]
npm ERR!     node_modules/@vue/cli-service
npm ERR!       peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/[email protected]
npm ERR!       node_modules/@vue/cli-plugin-babel
npm ERR!         dev @vue/cli-plugin-babel@"~4.5.0" from the root project
npm ERR!       4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...)
npm ERR!   19 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev less-loader@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^5.0.0" from [email protected]
npm ERR!   node_modules/less-loader
npm ERR!     dev less-loader@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Administrator\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2021-11-30T09_15_59_630Z-debug.log

Solution:

Error reason: the installed version is too high

Solution:

Delete the previous version: NPM uninstall less loader download the specified version: NPM install less- [email protected] -D

If an error is still reported, the file node_Modules can be removed, Download NPM install again

[Solved] nodejs express Error: MulterError: Unexpected field

Problems encountered when using express to write and upload files

The front-end Axios and the back-end express use the multer middleware. They always report the error of the server 500 when uploading. They repeatedly check the code and check the multer documents, and finally find the problem.

No more nonsense, just go to the code:

Back end:

router.post('/upload',upload.single('img'),function(req,res,next){
    console.log(req.file);
})

front end:

formdata.append('img',imgfile);

here, the name in upload.Single() should be consistent with the field name in the front end formdata

Vue Error: renren-fast-vue execute npm install Error [How to Solve]

Resolution NPM: unable to load file D:\code\Renren fast Vue\node_ modules.bin\npm.ps1

There are four steps

It is forbidden to run scripts on this system, that is, you do not have permission. First use the following command:

get-ExecutionPolicy

If output:

Restricted

The above indicates restricted and the status is prohibited. Then give a permission:

Set-ExecutionPolicy -Scope CurrentUser

Re enter:

RemoteSigned

The above is OK. If you want to verify it, enter get executionpolicy and output remotesigned

==================================================================

Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})    
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2021-12-03T02_48_23_436Z-debug.log
PS D:\work\guigu\guli-vue\renren-fast-vue> get-ExecutionPolicy
Restricted
PS D:\work\guigu\guli-vue\renren-fast-vue> Set-ExecutionPolicy -Scope CurrentUser

cmdlet Set-ExecutionPolicy in command pipeline location 1
Please provide values for the following parameters:
ExecutionPolicy: RemoteSigned
PS D:\work\guigu\guli-vue\renren-fast-vue> get-ExecutionPolicy
RemoteSigned
PS D:\work\guigu\guli-vue\renren-fast-vue> npm install

vue-elemnt-admin npm run dev [How to Solve]

Vue elemnt admin NPM run dev run error

Description:

vue-element-admin 4.4.4

There is the previous Vue element admin template in the computer, which can run normally, but the following error will be prompted when pulling the latest version

Error content

 DONE  Compiled successfully in 4163ms                                                                                                            4:26:31 ├F10: PM┤


  App running at:
  - Local:   http://localhost:9528
  - Network: http://192.168.70.192:9528

  Note that the development build is not optimized.
  To create a production build, run npm run build.

events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:9528' ]
}

Solution:

Comment out open: true in vue.config.js

 

Description of the modified part

For vue projects, find the devServer configuration proxy in vue.config.js
 
  devServer: {
    port: 8081, // port
    // open: true, // whether to open the browser automatically
    overlay: {
      warnings: false,
      errors: true
    },
    hot: true, // simply set to true, if the compiler reports an error, it will throw an error and you change it to the correct one, which will trigger a recompile again and the whole browser will be refreshed!
    headers: {
      'Access-Control-Allow-Origin': '*', //Allows access to all domains 
      'Access-Control-Allow-Credentials': 'true' // whether to allow subsequent requests to carry authentication information (cookies), the value can only be true, otherwise do not return
    },
    host: '0.0.0.0',
    proxy: { // proxy
      '/admin': {
        target: 'http://192.168.1.100:8080', // backend port address
        changeOrigin: true, // option to host the site virtually based on the name, if not configured, the request will report a 404 If the interface crosses the domain, this parameter needs to be configured
        ws: true, // true/false, whether to proxy websockets
        secure: false, // if the interface is https, you need to configure this parameter
        pathRewrite: {
          '^/admin': '' // pathRewrite is the request path to redirect to match the correct request address when using the proxy for proxying
        }
      }
    }
  }

[Solved] Vue Element Date plug-in reports an error in form validation

Error Messages:

Error in event handler for “el.form.change”: “TypeError: value.getTime is not a function”

Element UI’s date picker el-date-picker in addition to format value-format=”yyyy-MM-dd” and format=”yyyy-MM-dd”
In form validation.

{ type: 'date', required: true, message: 'Please select a date', trigger: 'change' } 

There will be conflicts

Solution: modify the verification rules

type: ‘date’-> type: ‘string’

Possible causes of errors:

After the format conversion of the element UI, the binding value will be converted to a string, and the type: ‘date’ in the verification rule does not match. As for its error, it is converted to a string, not a date object, so there is no gettime method.

[Solved] Error: Transform failed with 1 error: error: Invalid option in transform() call: “jsx“

Error: Transform failed with 1 error: error: invalid option in transform() call: “JSX”

Solution:

    1. the option “JSX” is invalid due to the old esbuild version
    1. 2. Manually install the latest version of esbuild to solve it, But I think it’s better to update the package.json version of the plug-in
    1. rollback plugin esbuild version: find the esbuild in the package.json plug-in and manually modify the esbuild version: 0.12.7
    1. 3. Install yarn add — dev rollback plugin- [email protected] Can solve

Error reporting: as shown in the following figure

Solution
parkage.json configuration! This is very important

 "devDependencies": {
    "@vue/compiler-sfc": "3.0.0",
    "rollup-plugin-esbuild": "2.5.0",
    "rollup-plugin-scss": "2.6.0",
    "rollup-plugin-terser": "7.0.2",
    "rollup-plugin-vue": "6.0.0-beta.10",
    "sass": "1.32.11",
    "vite": "1.0.0-rc.1"
   } 

Rollup.config.ts file configuration

import esbuild from 'rollup-plugin-esbuild'
import vue from 'rollup-plugin-vue'
const scss = require('rollup-plugin-scss');
const dartSass = require('sass');
import { terser } from "rollup-plugin-terser"

export default {
    input: 'src/lib/index.ts',
    output: [{
        globals: {
            vue: 'Vue'
        },
        name: 'Gulu',
        file: 'dist/lib/gulu.js',
        format: 'umd',
        plugins: [terser()]
    }, {
        name: 'Gulu',
        file: 'dist/lib/gulu.esm.js',
        format: 'es',
        plugins: [terser()]
    }],
    plugins: [
        scss({ include: /\.scss$/, sass: dartSass }),
        esbuild({
            include: /\.[jt]s$/,
            minify: process.env.NODE_ENV === 'production',
            target: 'es2015'
        }),
        vue({
            include: /\.vue$/,
        })
    ],
}

proxy error: could not proxy request [How to Solve]

Find the vue.config.js file and change the address:

devServer: {
  proxy: {
    '/api': {
      target: "http://localhost:Port number own address", //This replacement is the local address
      changeOrigin: true,
      logLevel: "debug"
    }
  }
}

Note:

vue.config.js   Is an optional configuration file if the project’s (and   package.json   If this file exists in the root directory of the same level, it will be deleted  @ vue/cli-service   Automatic loading. You can also use   package.json   Medium   vue   Field, but note that this writing method requires you to strictly follow the JSON format.

Create in root directory: vue.config.js

[Solved] Error: EPERM: operation not permitted (Permissions issue)

NPM download dependency error

npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path E:\code\20200212\web\cbos2.0-wenlv-wx-cli\node_modules\.staging\caniuse-lite-70323fe6\data\features\document-scrollingelement.js
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'E:\code\20200212\web\cbos2.0-wenlv-wx-cli\node_modules\.staging\caniuse-lite-70323fe6\data\features\document-scrollingelement.js'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'E:\code\20200212\web\cbos2.0-wenlv-wx-cli\node_modules\.staging\caniuse-lite-70323fe6\data\features\document-scrollingelement.js'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'E:\code\20200212\web\cbos2.0-wenlv-wx-cli\node_modules\.staging\caniuse-lite-70323fe6\data\features\document-scrollingelement.js'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'E:\\code\\20200212\\web\\cbos2.0-wenlv-wx-cli\\node_modules\\.staging\\caniuse-lite-70323fe6\\data\\features\\document-scrollingelement.js'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'E:\\code\\20200212\\web\\cbos2.0-wenlv-wx-cli\\node_modules\\.staging\\caniuse-lite-70323fe6\\data\\features\\document-scrollingelement.js',
npm ERR!   parent: 'cbos2.0-wenlv-wx-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\nodejs\node_cache\_logs\2021-11-25T08_55_03_606Z-debug.log

NPM installation has reported this all the time before, thinking that the permissions are really insufficient. I feel a little strange. It’s useless to execute with administrator permissions. However, I checked later and thought it was a cache problem. Just clean up the cache without administrator permissions. But it doesn’t work (see below)

Method 1

Npmrc files need to be deleted.

Stress: it is not the npmrc file under the NPM module in the nodejs installation directory, but the. Npmrc file under C: \ users {account} \. Delete the dependency and download it again

Method 2

Or you can clean it directly with the command. On the console, enter:

npm cache clean --force

I think it’s because I downloaded cnpm before, which leads to permission problems. In the future, the problem will be solved by installing the package with cmpn

[Solved] VUE D:\project\vueProject\vue-02\src\components\hello.vue 5:5 error Parsing error: x-invalid-end-tag

Vue use failure:

D:\project\vueProject\vue-02\src\components\hello.vue

5:5   error   Parsing error: x-invalid-end-tag   vue/no-parsing-error

Such an error was reported when the slot was introduced. After careful inspection, it was found that the label of the slot was written incorrectly.

It should be the <slot/> slash at the back, and it will return to normal after the change.

<!-- /* html page */ -->
<template>
  <div>
    <!-- slot -->
    </slot>
    <h3>This is a custom component hello</h3>
  </div>

</template>


<!-- /* javaScript */ -->
<script>
  export default {

  }
</script>

<!-- /* css */ -->
<style>

</style>