模块构建失败(来自./node_modules/babel-loader/lib/index.js)Vue Js

时间:2020-03-19 22:43:11

标签: javascript node.js vue.js npm babeljs

我从GitHub下载了一个我和我的朋友正在研究的项目,但是当我尝试运行时

npm run serve

我收到此错误

./src/main.js中的

错误

Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in /home/haider/Desktop/L7G/node_modules/@babel/helper-compilation-targets/package.json
    at applyExports (internal/modules/cjs/loader.js:524:9)
    at resolveExports (internal/modules/cjs/loader.js:541:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:661:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:963:27)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/haider/Desktop/L7G/node_modules/@babel/preset-env/lib/debug.js:8:33)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/haider/Desktop/L7G/node_modules/@babel/preset-env/lib/index.js:11:14)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)

 @ multi (webpack)-dev-server/client?http://192.168.0.109:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

main.js的内容:

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import BootstrapVue from 'bootstrap-vue'
import { ValidationProvider, extend } from 'vee-validate';

// import 'bootstrap/dist/css/bootstrap.css'
// import 'bootstrap-vue/dist/bootstrap-vue.css'


Vue.config.productionTip = false
Vue.prototype.$form = false;
Vue.prototype.$sidebarShow = false;

Vue.use(BootstrapVue)
// Add a rule.
extend('secret', {
  validate: value => value === 'example',
  message: 'This is not the magic word'
});

// Register it globally
Vue.component('ValidationProvider', ValidationProvider);
// Vue.component('ValidationProvider', ValidationProvider);


new Vue({
  store,
  router,
  render: h => h(App)
}).$mount('#app')

这是我正在使用的工具: 节点v13.10.1 npm v6.14.2 @ vue / cli 4.2.3 操作系统Manjaro Linux

这是我试图解决的问题: 重新安装节点模块 重新安装Node.js 使用不同的node.js版本-v12.16.1 使用不同版本的Vue

任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:5)

我通过从项目中删除node_modules文件夹和package-lock.json然后运行来解决了该问题

public class TestController : ApiController
{
    [HttpPost]
    // POST api/values
    public HttpResponseMessage Post(string value)
    {
        //validate user
        //do some other stuff
        //return response;
    }
}

这解决了问题:)