【问题标题】:NPM run watch cant find module webpacknpm run watch 找不到模块 webpack
【发布时间】:2018-01-28 03:06:39
【问题描述】:

我有一个包含一些包的 package.json。一旦我使用npm install,它将安装所有需要的项目,但它也会创建符号链接:

/Users/donny/Sites/Homestead/node_modules/lodash -> /usr/local/lib/node_modules/lodash
/Users/donny/Sites/Homestead/node_modules/promise -> /usr/local/lib/node_modules/promise
/Users/donny/Sites/Homestead/node_modules/underscore -> /usr/local/lib/node_modules/underscore
/Users/donny/Sites/Homestead/node_modules/less -> /usr/local/lib/node_modules/less
/Users/donny/Sites/Homestead/node_modules/axios -> /usr/local/lib/node_modules/axios
/Users/donny/Sites/Homestead/node_modules/bootstrap -> /usr/local/lib/node_modules/bootstrap
/Users/donny/Sites/Homestead/node_modules/bootstrap-sass -> /usr/local/lib/node_modules/bootstrap-sass
/Users/donny/Sites/Homestead/node_modules/cross-env -> /usr/local/lib/node_modules/cross-env
/Users/donny/Sites/Homestead/node_modules/jquery -> /usr/local/lib/node_modules/jquery
/Users/donny/Sites/Homestead/node_modules/js-cookie -> /usr/local/lib/node_modules/js-cookie
/Users/donny/Sites/Homestead/node_modules/laravel-echo -> /usr/local/lib/node_modules/laravel-echo
/Users/donny/Sites/Homestead/node_modules/laravel-elixir -> /usr/local/lib/node_modules/laravel-elixir
/Users/donny/Sites/Homestead/node_modules/laravel-mix -> /usr/local/lib/node_modules/laravel-mix
/Users/donny/Sites/Homestead/node_modules/less-loader -> /usr/local/lib/node_modules/less-loader
/Users/donny/Sites/Homestead/node_modules/moment -> /usr/local/lib/node_modules/moment
/Users/donny/Sites/Homestead/node_modules/spinkit -> /usr/local/lib/node_modules/spinkit
/Users/donny/Sites/Homestead/node_modules/pusher-js -> /usr/local/lib/node_modules/pusher-js
/Users/donny/Sites/Homestead/node_modules/sweetalert -> /usr/local/lib/node_modules/sweetalert
/Users/donny/Sites/Homestead/node_modules/toastr -> /usr/local/lib/node_modules/toastr
/Users/donny/Sites/Homestead/node_modules/urijs -> /usr/local/lib/node_modules/urijs
/Users/donny/Sites/Homestead/node_modules/v-tooltip -> /usr/local/lib/node_modules/v-tooltip
/Users/donny/Sites/Homestead/node_modules/vue-codemirror -> /usr/local/lib/node_modules/vue-codemirror
/Users/donny/Sites/Homestead/node_modules/vue -> /usr/local/lib/node_modules/vue

之后我尝试运行npm run watch,然后我得到错误

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules/webpack/bin/webpack.js ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:504:3

有人知道怎么解决吗?

【问题讨论】:

    标签: node.js laravel-5 webpack laravel-mix


    【解决方案1】:

    请检查您的 index.html 应该是

    <!-- Ionic's root component and where the app will load -->
      <ion-app></ion-app>
    
      <!-- The polyfills js is generated during the build process -->
      <script src="build/polyfills.js"></script>
    
      <!-- all code from node_modules directory is here -->
      <script src="build/vendor.js"></script> // <-- Include this line.
    
      <!-- The bundle js is generated during the build process -->
      <script src="build/main.js"></script>

    通过重新安装 Ionic 和 Cordova 也可以轻松解决此问题。

    【讨论】:

    • 这与NPM无关
    猜你喜欢
    • 1970-01-01
    • 2019-04-05
    • 2021-07-15
    • 1970-01-01
    • 1970-01-01
    • 2017-10-22
    • 2016-10-12
    • 1970-01-01
    • 2020-01-05
    相关资源
    最近更新 更多