Tag Archives: webpack

error: File not found by glob???

Several situations that lead to the above problems:
1. The package name of RPM package contains such special symbols as “[,]”;
2. When rM-IVH XXXX. RPM, XXXX packet name does not exist;
3. The directory name at the top of RPM package does not exist or has problems; — I have made this trap of the problem, it took several days to solve.
Solutions:
1. Modify the package name of RPM package through MV;
2. Add packages to install in the installation directory;
3. Correct the directory name of RPM package to keep it consistent with the directory specified in the installation software;

Reproduced in: https://www.cnblogs.com/noxy/p/5794801.html

Webpack 4 : ERROR in Entry module not found: Error: Can’t resolve ‘./src’

ERROR in Entry Module not found: ERROR: Can’t resolve ‘./ SRC ‘in’ E:\ Documents\VSCode files\WebPackProject ‘
Specify the inlet and outlet through the configuration file
Js (must be in the project root directory)

const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
      path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  }
};

Not packaged by configuration file
By default, Webpack4 does not need to create webpack.config.js to configure the packaged entry and exit.
By default,
The entry is ./ SRC /index.js file
Exit to ./dist/main.js file
Directory structure:

Js is in the correct position. Run the command in the project root directory:

webpack

You are ready to pack.


So now you can see that under the project directory, dist folder, you’ll see the packaged file main.js;
In the HTML file index. HTML which needs to be introduced, it can be correctly introduced.

You can also specify it manually using the following command:
webpack./SRC /index.js -- output-filename. /dist/main.js --output-path. --mode development
or
webpack ./src/index.js -o ./dist/main.js --mode development
note:
, --mode development is the specified development mode, without which warning will be reported;
Another mode is --mode production specifies the production mode. In this mode, the packaged js file will be compressed, but the former will not.
Webpack will prompt a warning when executing directly from above. Closing the warning can be packaged by the following command:
webpack --mode development
or
webpack --mode production
`


OTS parsing error: invalid version tag

Error in browser is

The actual display effect is

 
Style.css (static/ static/ static/ static/ static/ static/ static/ static/ static/ static/ static/. The results did not change, or an error, see a foreign great god q&a https://stackoverflow.com/questions/34133808/webpack-ots-parsing-error-loading-fonts#, according to the above revised compulsory publicPath, still won’t do, tried a half a day since path is the problem, then use relative paths try, change the way to.. /static/…. And success!

NPM compilation failed: can’t resolve ‘child_ process’

Failed to compile.
Fsevents /node_modules/[email protected]@fsevents/node_modules/ detector-libc /lib/ detector-libc.js
Module not found: Error: Can’t resolve ‘child_process’ in ‘D:\Today\WebFront\node_modules\[email protected]@fsevents\node_modules\detect-libc\lib’

NPM install –save child_process FS prompted by various attempts, also tried to delete node_modules folder to re-install NPM, and even sent the code undo back to re-paste the files with changes, but failed!
Baidu saw that someone had encountered similar problems, and added the following nodes in Webpack.base.config.js:

node: {

        // prevent webpack from injecting useless setImmediate polyfill because Vue
        // source contains it (although only uses it if it's native).
        //setImmediate: false,
        // prevent webpack from injecting mocks to Node native modules
        // that does not make sense for the client
        //dgram: 'empty',
       fs: 'empty',
        //net: 'empty',
        //tls: 'empty',
        child_process: 'empty'
    }

This action will result in a compile without error, but with various warnings, NPM Run Dev will not load the VUE component; It seems that there is no way around this question.
Think carefully about what the code changed before the error: found the following weird import

When I add debugger, the VS tool automatically introduces this for me, kill it, and re-run NPM run Dev
See the long lost green prompt:

Alas, I spent half a day trying to solve the problem, and I learned a lot in the process of finding the problem. There were still many pits in the application of VUE, which led to all kinds of strange mistakes. Record here!

How to Fix webpack Module build failed Error: The node API for ‘babel’ has been moved to babel-core

Red when webpack is packaged:

Module build failed: Error: The node API for 'babel' has been moved to babel-core

There is nothing available on the web,
so delete the entire node_modules folder,
download the dependency package again:

npm init;
cnpm install --save babel-loader babel-preset-es2015 babel-preset-react babel-core

And to pack:

webpak

Ok, perfect!

Miscellaneous Notes (2)

Hide the scroll bar and keep the scroll effect


.outer-container {
    overflow: hidden;        // 隐藏滚动条
    width: 240px;          // 内容宽度,同时配合子元素
    height: 100%;
  }
  .inner-container {
    overflow-x: hidden; // 隐藏水平滚动条
    overflow-y: scroll;    // 产生垂直滚动
    width: 257px;       // 比父元素宽出滚动条的宽度 17px
    height: 100%;          // 设置产生滚动条
  }
  .inner-container::-webkit-scrollbar {
    display: none;            //  webkit 内核的浏览器仅需设置此属性
  }

// 另一种方法,在滚动的容器设置
.inner-container {
    margin-right: -17px;
}

错误:pathspec的字段与git已知的任何文件不匹配。

// 需要在提交时将描述信息放在两重引号中,原因疑是 git 无法识别 文件名或路径
git add .
git commit -m "'your message'"
git pull origin master
git push origin master

Check whether to jump after logging in to prevent an endless loop


router.beforeEach((to, from, next) => {
    out //判断登录状态简单实例
    var userInfo = window.localStorage.getItem('token');
    if (userInfo) {
        next();
    } else {
        next('/login');
    }
})

// 以上会发现出现如下错误:出现 dead loop错误,解决方法如下所示
// 解决思路:排除此时地址 = 转向的地址 的情况,避免dead loop
router.beforeEach((to, from, next) => {
    var userInfo = window.localStorage.getItem('token');//获取浏览器缓存的用户信息
    if(userInfo){ //如果有就直接到首页咯
        next();
    } else {
        if(to.path=='/login'){ //如果是登录页面路径,就直接next()
            next();
        } else { //不然就跳转到登录;
            next('/login');
        }

    }
})

BrowserslistError: Unknown browser major
Bootstrap.min. js normal bootstrap.min. CSS error reporting


ERROR in ./node_modules/css-loader?minimize!./node_modules/autoprefixer-loader!./node_modules/bootstrap/dist/css/bootstrap.min.css
    Module build failed: BrowserslistError: Unknown browser major
        at error (E:\project\node_modules\browserslist\index.js:37:11)
        at Function.browserslist.checkName (E:\project\node_modules\browserslist\index.js:320:18)
        at Function.select (E:\project\node_modules\browserslist\index.js:438:37)
        at E:\project\node_modules\browserslist\index.js:207:41
        at Array.forEach (<anonymous>)
        at browserslist (E:\project\node_modules\browserslist\index.js:196:13)
        at Browsers.parse (E:\project\node_modules\autoprefixer\lib\browsers.js:44:14)
        at new Browsers (E:\project\node_modules\autoprefixer\lib\browsers.js:39:28)
        at loadPrefixes (E:\project\node_modules\autoprefixer\lib\autoprefixer.js:56:18)
        at plugin (E:\project\node_modules\autoprefixer\lib\autoprefixer.js:62:18)
        at LazyResult.run (E:\project\node_modules\postcss\lib\lazy-result.js:274:20)
        at LazyResult.sync (E:\project\node_modules\postcss\lib\lazy-result.js:261:32)
        at LazyResult.stringify (E:\project\node_modules\postcss\lib\lazy-result.js:285:14)
        at LazyResult.get (E:\project\node_modules\postcss\lib\lazy-result.js:334:25)
        at Object.module.exports (E:\project\node_modules\autoprefixer-loader\index.js:55:35)

Solutions:

// Edit node_modules\bootstrap\package.json: Remove these lines:

"last 1 major version",
">= 1%",

Use the font – awesome webpack – vue
NPM installs font-awesome and any dependencies it requires


npm install less less-loader css-loader style-loader file-loader font-awesome --save

Globally register font-awesome in the entry file


import 'font-awesome/css/font-awesome.min.css';

Configure the parsing


{
    test: /\.(gif|jpg|jpeg|png|woff|svg|eot|ttf)\??.*$/,
    loader: 'url-loader?limit=1024'
},

Iview navigation component: after the current page is selected, click refresh or click the browser back button, the selected navigation bar disappears


在vuex的 state 存储 active-name,根据路由用 computed 取出 active-name

Reproduced in: https://www.cnblogs.com/anani/p/9643819.html

Webpack — module build failed: error: the node API for ‘Babel’ has been moved to Babel core

webpack is red when packaged:

Module build failed: Error: The node API for 'babel' has been moved to babel-core

there is nothing available on the web,
so delete the entire node_modules folder,
to download the dependency package again:

npm init;
cnpm install --save babel-loader babel-preset-es2015 babel-preset-react babel-core

and then pack:

webpak

ok, perfect!

Webpack error module build failed: typeerror: fileSystem.statSync is not a function

follow the video operation, delete node_modules directory, webpack

ERROR in ./src/js/index.js
Module build failed: TypeError: fileSystem.statSync is not a function
    at module.exports (/Users/mac/source/9-01/node_modules/babel-loader/lib/utils/exists.js:7:25)
    at find (/Users/mac/source/9-01/node_modules/babel-loader/lib/resolve-rc.js:13:9)
    at Object.module.exports (/Users/mac/source/9-01/node_modules/babel-loader/lib/index.js:113:132)

Baidu once, someone said because
webpack version inconsistency results. So reinstall

npm install webpack --save-dev

There are many warnings when performing this step

npm notice save webpack is being moved from dependencies to devDependencies
npm WARN [email protected] requires a peer of webpack@2 || 3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of jquery@>=1.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

The babel-Loader version requires a more advanced WebPack, so execute the following statement to install version 3.0

npm install [email protected] --save-dev

Execute the WebPack and it will run successfully.