ERROR errno -4048,Error: EPERM: operation not permitted

npm install 报错(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解决方法

ERROR errno -4048,Error: EPERM: operation not permitted_第1张图片
清理缓存:

npm  cache clear --force

在这里插入图片描述


再次执行并安装mongoose
ERROR errno -4048,Error: EPERM: operation not permitted_第2张图片
引入:

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/demo',{ useNewUrlParser: true });
var db = mongoose.connection;

db.on('error',function(){
	console.log('failure:'+error);
});
db.on("open",function(){
	console.log("数据库连接成功");
});
db.on("disconnected",function(){
	console.log("数据库连接断开");
});
module.exports=db

mongooseAPI

你可能感兴趣的:(node.js)