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
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
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.
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
.
Following command work for me:
sudo npm i -g node-pre-gyp
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.
Just use this command and it will handle this error npm install --unsafe-perm --allow-root