项目场景:

项目场景:新到手上的vue做的振动传感器界面的源代码,要复制出环境来所出现的问题和解决方法小记


问题描述

npm run build 后出现的问题

  • building for production…(node:19160) Warning: Accessing non-existent property ‘cat’ of module exports inside circular dependency

npm audit fix --force


  • compiler.hooks.compilation.tap(
    ^
    TypeError: Cannot read property ‘compilation’ of undefined

npm install 这里莫名就好了

\node_modules\copy-webpack-plugin\dist\index.js:56
compiler.hooks.emit.tapAsync(plugin, (compilation, callback) => {
^

TypeError: Cannot read property ‘emit’ of undefined

npm install copy-webpack-plugin

internal/modules/cjs/loader.js:888
throw err;
^

Error: Cannot find module ‘ajv/dist/compile/codegen’

npm i ajv
npm install ajv-errors@1.0.1

45 packages are looking for funding
run npm fund for details
(use npm audit fix --force to install breaking changes; or refer to npm audit for steps to fix these manually)
TypeError: Cannot read property ‘emit’ of undefined

npm audit fix --force
npm install optimize-css-assets-webpack-plugin@3.2.0
npm i copy-webpack-plugin

E:\cesar\vibrationServer\iris-vibmonitor-vue\wiihey-frontend\wiihey-frontend\build\webpack.prod.conf.js:32
new webpack.optimize.UglifyJsPlugin({
^
TypeError: webpack.optimize.UglifyJsPlugin is not a constructor

npm i uglifyjs-webpack-plugin
npm audit fix --force

Error: Cannot find module ‘webpack-cli/package.json’

npm i webpack@3.6.0

throw err;
^
Error: Cannot find module ‘postcss’

npm i postcss

internal/modules/cjs/loader.js:888
throw err;
^

Error: Cannot find module ‘cssnano’

npm i cssnano --save

Tip: built files are meant to be served over an HTTP server.
Opening index.html over file:// won’t work.

npm install -g http-server

Listening at http://localhost:8080

部署成功后,这里有可能http://localhost:8080 这个打不开 要把localhost 换成127.0.0.1就可以打开了网站了

Module build failed: ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.

  • options has an unknown property ‘minimize’. These properties are valid:

npm install css-loader --force

Error: Cannot find module ‘shelljs’

npm install shelljs

Error: Cannot find module ‘ora’

yarn add ora

原因分析:

百分之九十五是模块因为版本升级而导致一些函数丢失不匹配问题,基本能不升级版本就不升级,还有确实module导致的 都直接npm install上去就可以了,vue所谓开发方便是基于不改变环境的情况下,不然换个环境就单搞插件就得搞麻了麻了麻了,而且官方的问答区还没什么官方客服,据说官方在后期还打算收费问答区,绝绝子,真是栓Q了


解决方案:

如上大家DDDD的

Logo

前往低代码交流专区

更多推荐