在vue项目创建的后初始化首次使用stylus安装方法
作者:
秒速五厘米
ERROR Failed to compile with 2 errors 20:10:24 These dependencies were not found: * common/stylus/index.styl in ./src/main.js * !!vue-style-loader!css-loader?{"sourceMap":true}!../node_modules/vue-loader/ lib/style-compiler/index?{"vue":true,"id":"data-v-7ba5bd90","scoped":true, "hasInlineConfig":false}!stylus-loader?{"sourceMap":true}!../node_modules /vue-loader/lib/selector?type=styles&index=0!./App.vue in ./src/App.vue To install them, you can run: npm install --save common/stylus/index.styl !!vue-style-loader!css-loader?{"sourceMap":true}!../node_modules/vue-loader /lib/style-compiler/index?{"vue":true,"id":"data-v-7ba5bd90","scoped":true, "hasInlineConfig":false}!stylus-loader?{"sourceMap":true}!../node_modules /vue-loader/lib/selector?type=styles&index=0!./App.vue
npm install stylus-loader css-loader style-loader --save-dev
Module build failed: Error: Cannot find module 'stylus' at Function.Module._resolveFilename (module.js:485:15) at Function.Module._load (module.js:437:25) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at Object.<anonymous> (E:\project\selling\node_modules\stylus-loader\index.js:2:14) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) ------------------------------------
npm install stylus 然后执行 npm run dev
解决
因此在首次初始化的时候需要进行如下步骤的安装
1.npm install stylus --save-dev 2.npm install stylus-loader --save-dev 3.npm run dev(每次改动了配置文件均需要重新启动项目)