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

时间:2021-01-18 10:33:34

标签: browserify shelljs

我正在测试 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'

0 个答案:

没有答案