browserify'错误:无法找到模块“在试图解决”未捕获引用错误:要求没有定义“ [英] browserify 'Error: Cannot find module' in trying to fix 'Uncaught reference error: require is not defined'
问题描述
我有一个非常类似的,或几乎准确,发行,从这个线程@RachelD(<一个href=\"http://stackoverflow.com/questions/18195697/node-js-angular-uncaught-referenceerror-require-is-not-defined\">Node.js +角=未捕获的ReferenceError:要求没有定义)关于未捕获引用错误。然而,当我跑我的'browserify命令,在这里指出的方向( https://github.com/ substack /节点browserify )及以下严格按照图示(我包括我的目录,以及供参考)...
I am having a very similar, or almost exact, issue to @RachelD from this thread (Node.js + Angular = Uncaught ReferenceError: require is not defined) regarding the Uncaught reference error. However, when I run my 'browserify' command as stated in the directions here (https://github.com/substack/node-browserify) and exactly as shown below (I included my directory as well for reference)...
myname@compname:~/workspace/MyApp $ browserify /app/scripts/controllers/main.js > bundle.js
我得到一个无法找到模块错误
I am getting a 'Cannot find module' error
Error: Cannot find module '/app/scripts/controllers/main.js' from '/Users/myname/workspace/MyApp'
at /usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:35:25
at load (/usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:53:43)
at /usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:59:22
at /usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:16:47
at Object.oncomplete (fs.js:107:15)
我如何突破这个错误?
How do I get past this error?
推荐答案
您使用的是绝对路径: /app/scripts/controllers/main.js
。您可能希望应用程序/脚本/控制器/ main.js
。
You are using an absolute path: /app/scripts/controllers/main.js
. You probably want app/scripts/controllers/main.js
.
这篇关于browserify'错误:无法找到模块“在试图解决”未捕获引用错误:要求没有定义“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!