npm UNMET PEER DEPENDENCY error, Can't install

2020-03-30 10:06发布

问题:

I'm trying somethings with braintree and firebase functions. But when i run:

npm install braintree

My terminal says:

PS C:\Users\Hugo\Desktop\The store\web2\store\functions> npm install braintree
functions@ C:\Users\Hugo\Desktop\The store\web2\store\functions
+-- braintree@2.4.0
`-- UNMET PEER DEPENDENCY firebase-admin@5.4.3
  +-- UNMET PEER DEPENDENCY  extraneous error: ENOENT: no such file or directory, open 'C:\Users\Hugo\Desktop\The store\web2\store\functions\node_modules\firebase-admin\node_modules\tslint\package.json
  `-- UNMET PEER DEPENDENCY  extraneous error: ENOENT: no such file or directory, open 'C:\Users\Hugo\Desktop\The store\web2\store\functions\node_modules\firebase-admin\node_modules\typescript\package.json

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Hugo\Desktop\The store\web2\store\functions\node_modules\firebase-admin\node_modules\tslint\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Hugo\Desktop\The store\web2\store\functions\node_modules\firebase-admin\node_modules\typescript\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Hugo\Desktop\The store\web2\store\functions\node_modules\firebase-admin\node_modules\tslint\node_modules\findup-sync\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Hugo\Desktop\The store\web2\store\functions\node_modules\firebase-admin\node_modules\tslint\node_modules\diff\package.json'
npm WARN gulp-tslint@6.1.3 requires a peer of tslint@^3.7.3 || 3.7.0-dev.5 || >=3.8.0-dev || >=3.9.0-dev || >=3.10.0-dev || >=3.11.0-dev || >=3.12.0-dev || >=3.13.0-dev || >=3.14.0-dev || >=3.15.0-dev || >=3.16.0-dev || >= 4.0.0-dev but none was installed.
npm WARN gulp-typescript@3.2.3 requires a peer of typescript@~2.0.3 || >=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev but none was installed.
npm WARN firebase-functions@0.7.5 requires a peer of firebase-admin@~5.5.0 but none was installed.

And there is no braintree in my package.json file.

回答1:

First delete node_modules folder in your app's directory.

rm -rf node_modules/

and then

npm cache clean
npm update -g npm

finally

 npm install
 npm install braintree --save