`node-pre-gyp install --fallback-to-build` failed during MeanJS installation on OSX

后端 未结 16 2080
遇见更好的自我
遇见更好的自我 2020-12-13 23:59

I just bought myself a mac book after using Windows for a long time.

I was trying to work on a MeanJS project that I had been working on. Doing npm install

相关标签:
16条回答
  • 2020-12-14 00:35

    I was solved this problem too: Just reinstall node to LTS version by nvm:

    nvm install --lts
    
    nvm use --lts
    

    Then rm -rf node_modules And npm i

    0 讨论(0)
  • 2020-12-14 00:38

    Alright so after some debugging the following dependencies are using an older version of touch:

    ./node_modules/bower/node_modules/decompress-zip/package.json:    "touch": "0.0.3"
    ./node_modules/bower/node_modules/lockfile/package.json:    "touch": "0"
    ./node_modules/gulp-nodemon/node_modules/nodemon/package.json:    "touch": "1.0.0",
    ./node_modules/gulp-nodemon/node_modules/touch/package.json:    "touch": "./bin/touch.js"
    ./node_modules/nodemon/package.json:    "touch": "~0.0.3",
    

    With that I was able to get meanJS working with node 5.

    Here is the history on the commands I ran:

    git clone https://github.com/meanjs/mean.git
    cd mean
    nvm install 5
    nvm use 5
    npm install
    which node-gyp
    npm install -g node-pre-gyp
    sudo xcodebuild -license
    npm install
    

    Had some issues and then:

    I added the following line:

    #!/usr/bin/env node

    To the top of the file ./mean/node_modules/.bin/touch

    And then:

    npm install
    

    And of course maybe throw in a sudo rm -rf ./node_modules && npm cache clean before retrying.

    0 讨论(0)
  • 2020-12-14 00:39

    Hope my scenario can help someone else. I had the same problem with the package bcrypt. First, I have tried with npm i -g node-gyp as suggested by Anne but the problem persisted. Then I read again the error message to have a better understanding of the problem and discovered that the script fails to build the package from scratch - since a precompiled version doesn't exist. In particular, it can't find the g++ command so I solved installing the build-essential package with sudo apt install build-essential -y.

    0 讨论(0)
  • 2020-12-14 00:42

    Following command work for me:

    sudo npm i -g node-pre-gyp
    
    0 讨论(0)
  • 2020-12-14 00:44

    i have tried upgrading node-gyp:

    sudo npm install -g node-gyp
    

    It worked for me.

    I find the solution here, I hope it can help.

    0 讨论(0)
  • 2020-12-14 00:44

    Just use this command and it will handle this error npm install --unsafe-perm --allow-root

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