Browserify - 未捕获的错误:找不到模块“./src/cat”

问题描述

我正在测试 shelljs 模块,该模块旨在使用简单的测试程序在 Chrome 浏览器上运行,但出现以下错误

can't find module '/.src/cat'

我使用以下命令在 shelljs 中安装了 node_modules 模块,但不知何故 browserify 无法选择它?:

npm install shelljs --save

有人可以帮助确定这个问题吗?

版本信息

  • browserify@17.0.0,
  • shelljs@0.84,
  • node@14.15.1

ma​​in.js

"use strict";
var sh = require('shelljs');
const output = sh.echo('Hello World!',{silent:true});
console.log(output);

index.html

<script src="bundle.js"></script>

命令行界面:

browserify --debug main.js -o bundle.js

从 Chrome 检查中得到以下错误

Uncaught Error: Cannot find module './src/cat'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)