Laravel Homestead, npm install --no-bin-links error

后端 未结 2 772
予麋鹿
予麋鹿 2021-01-28 15:50

I am using fresh Homestead (box version 0.5) for a fresh Laravel 5.3 app. Host OS is Windows 10.

I get this error when running npm install --no-bin-links

相关标签:
2条回答
  • 2021-01-28 16:37

    I have developed a particular method to make it all work. Here are the basic steps:

    • First, make a directory out of the Vagrant shared folder. It could be, e.g., '/home/vagrant/node'.
    • Right there, we would copy the package.json file from our Laravel installation to tell npm what to install... Note that the recently created 'node' directory is in a Unix system, nothing to do with our Windows host machine (as it is not part of a shared folder between both).
    • Third, we would run npm install command (without the --no-bin-links options as Unix supports symbolic links. There should be no errors ;)
    • Finally, we would move the 'node_modules' directory right back to our Laravel installation folder (the shared one), BUT having run the vagrant up command from a console with Admin Privileges in Windows host machine. Otherwise, trying to move the created symbolic links would result in an error.

    It will all work as it is the Unix machine that serves the Laravel app. This process will help you install Laravel Mix without problems.

    Cheers!

    0 讨论(0)
  • 2021-01-28 16:50

    You can try this, as it is the system I usually use:

    > npm install --no-bin-links
    > npm install --no-bin-links
    > npm rebuild node-sass
    

    The first npm install ususally errors out with the "Maximum call stack size exceeded.". The second npm install picks up where it left off and finishes up the install. node-sass is usually broken at this point, so the npm rebuild fixes the node-sass installation.

    0 讨论(0)
提交回复
热议问题