Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browserify-shim error when node_modules folder is a symlink #208

Closed
akalongman opened this issue Apr 12, 2016 · 3 comments
Closed

browserify-shim error when node_modules folder is a symlink #208

akalongman opened this issue Apr 12, 2016 · 3 comments

Comments

@akalongman
Copy link

On the production server node_modules folder is a symbolic link for continuous deployment purposes. When I run gulp command, I got many errors like this:

Error: Unable to find a browserify-shim config section in the package.json for /home/web/www/persist/node_modules/jquery-ui/jquery-ui.js while parsing file: /home/web/www/persist/node_modules/jquery-ui/jquery-ui.js]
  filename: '/home/web/www/persist/node_modules/jquery-ui/jquery-ui.js'
. . .

If I move node_modules in project folder, build process is successfull. How to solve this problem?

This question on StackOverflow:
http://stackoverflow.com/questions/36559378/browserify-shim-error-when-node-modules-folder-is-a-symlink

package.json file

{
    "private": true,
    "devDependencies": {
        "gulp": "^3.8.8"
    },
    "dependencies": {
        "bootbox": "^4.4.0",
        "bootstrap-daterangepicker": "^2.1.19",
        "bootstrap-sass": "^3.0.0",
        "browserify-shim": "^3.8.12",
        "eonasdan-bootstrap-datetimepicker": "^4.15.35",
        "font-awesome": "^4.5.0",
        "jquery": "^2.2.3",
        "jquery-ui": "^1.10.5",
        "jquery.maskedinput": "^1.4.1",
        "laravel-elixir": "^4.0.0",
        "moment": "^2.12.0",
        "select2": "^4.0.2"
    },
    "browserify": {
        "transform": ["browserify-shim"]
    },
    "browserify-shim": {
        "jquery": "$",
        "bootstrap": {
            "depends": ["jquery:jQuery"],
            "exports": "bootstrap"
        },
        "select2": {
            "depends": ["jquery:jQuery"],
            "exports": "$.fn.select2"
        },
        "bootbox": {
            "depends": ["jquery:jQuery", "bootstrap:bootstrap"],
            "exports": "bootbox"
        },
        "maskedinput": {
            "depends": ["jquery:jQuery"],
            "exports": "$.fn.mask"
        },
        "daterangepicker": {
            "depends": ["jquery:jQuery", "bootstrap:bootstrap"],
            "exports": "$.fn.daterangepicker"
        },
        "eonasdan-bootstrap-datetimepicker": {
            "depends": ["jquery:jQuery", "moment:moment", "bootstrap:bootstrap"],
            "exports": "$.fn.datetimepicker"
        }
    },
    "browser": {
        "jquery": "./node_modules/jquery/dist/jquery.js",
        "jquery-ui": "./node_modules/jquery-ui/jquery-ui.js",
        "eonasdan-bootstrap-datetimepicker": "./node_modules/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js",
        "select2": "./node_modules/select2/dist/js/select2.min.js",
        "bootbox": "./node_modules/bootbox/bootbox.min.js",
        "maskedinput": "./node_modules/jquery.maskedinput/src/jquery.maskedinput.js",
        "daterangepicker": "./node_modules/bootstrap-daterangepicker/daterangepicker.js",
        "moment": "./node_modules/moment/min/moment-with-locales.min.js",
        "bootstrap": "./node_modules/bootstrap-sass/assets/javascripts/bootstrap.js"
    }
}
@bendrucker
Copy link
Collaborator

Can you get a stacktrace for that error?

@thlorenz
Copy link
Owner

Linking breaks browserify and shim since your projects dependencies are outside of your project tree.
So when looking upwards these tools can't find the package.json of your package anymore.

So don't link your node_modules folders .. it's a bad idea anyways since you're then linked to a global in your system, i.e. it's better to have all your deps be local to your project.
Not sure what your deployment purposes are, but to me it seems like whoever made that decision didn't fully understand how node/npm is supposed to work.

@acao
Copy link

acao commented May 13, 2019

@thlorenz yarn link/npm link is a common scenario for developing multiple, interdependent repositories at once. This is an issue for the graphiql project

Repository owner locked as resolved and limited conversation to collaborators May 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants