Closed thlorenz closed 11 years ago
Just realized that this is actually happening in resolve, so I posted the same issue there as well.
Can you confirm which version of browser-resolve browserify uses? Iirc James had a fork. On Jun 15, 2013 11:04 PM, "Thorsten Lorenz" notifications@github.com wrote:
Here is the command I'm running from level-dumphttps://github.com/thlorenz/level-dumpto get the following error:
~/dev/js/projects/level-dump (master %) ➝ browserify test/*.js > bundle.js
/usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:91 var dir = path.resolve(x, pkg.main); ^ TypeError: Cannot read property 'main' of undefined at module.exports.dir (/usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:91:54) at load (/usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:54:43) at module.exports.cb (/usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:60:22) at module.exports.isFile (/usr/local/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:16:47) at Object.oncomplete (fs.js:297:15)
To reproduce just clone that repo and repeat the above step.
— Reply to this email directly or view it on GitHubhttps://github.com/shtylman/node-browser-resolve/issues/27 .
/usr/local/lib/node_modules/browserify (master)
➝ npm ls browser-resolve
browserify@2.18.1 /usr/local/lib/node_modules/browserify
└── browser-resolve@1.0.1
Check the package.json for what is actually installed. npm ls
can be misleading.
You are correct Sir!
Actual dep is: "browser-resolve": "git://github.com/substack/node-browser-resolve.git#dir-replace"
.
I'll never trustnpm ls
again ;)
I have to go back to browser-resolve@0.0.5
for anything to change.
I still get an error, but probably an unrelated problem:
~/dev/js/projects/level-dump (master %)
➝ browserify test/*.js > bundle.js
Error: module "os" not found from "/Users/thlorenz/dev/js/projects/level-dump/node_modules/level-test/index.js"
I've problems with this version: └─┬ browserify@2.22.0 └── browser-resolve@1.1.0
In order to create a browserify.js file, I run this command: browserify browserify > browserify.js
And I got this error: (same as mentioned above)
var dir = path.resolve(x, pkg.main); ^TypeError: Cannot read property 'main' of undefined
The stacktrace comes from the resolve module. I have asked @thlorenz to provide a smaller test case against the resolve module directly to figure out what usage causes this.
version 1.1.2 released with new resolve dep that should better handle this
Here is the command I'm running from level-dump to get the following error:
To reproduce just clone that repo and repeat the above step.