browserify-shim: Unable to find a browserify-shim config section in the package.json

I’m getting this when trying to require a file outside my app’s directory. So just the presence of require('../hmm') will spit out

Error: Unable to find a browserify-shim config section in the package.json for /Users/bclinkinbeard/Code/scratch/bug-reports/b-shim/hmm.js
    at /Users/bclinkinbeard/Code/scratch/bug-reports/b-shim/app/node_modules/browserify-shim/lib/resolve-shims.js:163:38
    at /Users/bclinkinbeard/Code/scratch/bug-reports/b-shim/app/node_modules/browserify-shim/node_modules/mothership/index.js:27:31
    at testDir (/Users/bclinkinbeard/Code/scratch/bug-reports/b-shim/app/node_modules/browserify-shim/node_modules/mothership/node_modules/find-parent-dir/index.js:20:36)
    at /Users/bclinkinbeard/Code/scratch/bug-reports/b-shim/app/node_modules/browserify-shim/node_modules/mothership/node_modules/find-parent-dir/index.js:26:7
    at Object.cb [as oncomplete] (fs.js:168:19)

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 23 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I’m also having this issue with the case that @Fauntleroy describes — where I’m npm linking in modules that I’m working on.

Workaround (mostly for my own reference) I have a directory structure like this:

|_ /app1
|_ /app2
|_ /app3
|_ /common_components (between all apps)

The common_components directory is symlinked from within the app directories.

I also got this error on code within the common_components directory, none of which have a package.json. I added package.json to the root directory like this:

|_ /app1
|_ /app2
|_ /app3
|_ /common_components
|_ package.json

This package.json just contains

{
    "browserify-shim": {}
}

Not an elegant solution, but this kills the error.