uniapp开发app框架在提升开发效率中的独特优势与应用探索
2501
2022-09-26
Module build failed: Error: Cannot find module 'node-sass'报错问题
由于重新装了一个系统,很多环境配置要重新配置。在想run 一个项目时,出现下面的错误:
error in ./src/page/Index.vueModule build failed: Error: Cannot find module 'node-sass' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.sassLoader (E:\trip_user_ui\node_modules\sass-loader\lib\loader.js:46:72) @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-c221866a","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false}!./node_modules/vux-loader/src/style-loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/page/Index.vue 4:14-424 13:3-17:5 14:22-432 @ ./src/page/Index.vue @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?webpack/hot/dev-server ./src/main.js error in ./src/page/addPerson.vueModule build failed: Error: Cannot find module 'node-sass' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.sassLoader (E:\trip_user_ui\node_modules\sass-loader\lib\loader.js:46:72) @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-485da622","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false}!./node_modules/vux-loader/src/style-loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/page/addPerson.vue 4:14-428 13:3-17:5 14:22-436 @ ./src/page/addPerson.vue @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?webpack/hot/dev-server ./src/main.js error in ./src/page/callPolice.vueModule build failed: Error: Cannot find module 'node-sass' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.sassLoader (E:\trip_user_ui\node_modules\sass-loader\lib\loader.js:46:72) @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-31d77fd3","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false}!./node_modules/vux-loader/src/style-loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/page/callPolice.vue 4:14-429 13:3-17:5 14:22-437 @ ./src/page/callPolice.vue @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?webpack/hot/dev-server ./src/main.js error in ./src/page/passenger.vueModule build failed: Error: Cannot find module 'node-sass' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.sassLoader (E:\trip_user_ui\node_modules\sass-loader\lib\loader.js:46:72) @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-9a9a079a","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false}!./node_modules/vux-loader/src/style-loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/page/passenger.vue 4:14-428 13:3-17:5 14:22-436 @ ./src/page/passenger.vue @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?webpack/hot/dev-server ./src/main.js然后报错说是找不到node-sass,那么想着install一个node-sass就行了。但是发现结果不是!!!输入命令npm install node-sass --save-dev
报错如下:
gyp info it worked if it ends with okgyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',gyp verb cli 'E:\\trip_user_ui\\node_modules\\node-gyp\\bin\\node-gyp.js',gyp verb cli 'rebuild',gyp verb cli '--verbose',gyp verb cli '--libsass_ext=',gyp verb cli '--libsass_cflags=',gyp verb cli '--libsass_ldflags=',gyp verb cli '--libsass_library=' ]gyp info using node-gyp@3.8.0gyp info using node@10.15.0 | win32 | x64gyp verb command rebuild []gyp verb command clean []gyp verb clean removing "build" directorygyp verb command configure []gyp verb check python checking for Python executable "python2" in the PATHgyp verb `which` failed Error: not found: python2gyp verb `which` failed at getNotFoundError (E:\trip_user_ui\node_modules\which\which.js:13:12)gyp verb `which` failed at F (E:\trip_user_ui\node_modules\which\which.js:68:19)gyp verb `which` failed at E (E:\trip_user_ui\node_modules\which\which.js:80:29)gyp verb `which` failed at E:\trip_user_ui\node_modules\which\which.js:89:16gyp verb `which` failed at E:\trip_user_ui\node_modules\isexe\index.js:42:5gyp verb `which` failed at E:\trip_user_ui\node_modules\isexe\windows.js:36:5gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)gyp verb `which` failed python2 { Error: not found: python2gyp verb `which` failed at getNotFoundError (E:\trip_user_ui\node_modules\which\which.js:13:12)gyp verb `which` failed at F (E:\trip_user_ui\node_modules\which\which.js:68:19)gyp verb `which` failed at E (E:\trip_user_ui\node_modules\which\which.js:80:29)gyp verb `which` failed at E:\trip_user_ui\node_modules\which\which.js:89:16gyp verb `which` failed at E:\trip_user_ui\node_modules\isexe\index.js:42:5gyp verb `which` failed at E:\trip_user_ui\node_modules\isexe\windows.js:36:5gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)gyp verb `which` failed stack:gyp verb `which` failed 'Error: not found: python2\n at getNotFoundError (E:\\trip_user_ui\\node_modules\\which\\which.js:13:12)\n at F (E:\\trip_user_ui\\node_modules\\which\\which.js:68:19)\n at E (E:\\trip_user_ui\\node_modules\\which\\which.js:80:29)\n at E:\\trip_user_ui\\node_modules\\which\\which.js:89:16\n at E:\\trip_user_ui\\node_modules\\isexe\\index.js:42:5\n at E:\\trip_user_ui\\node_modules\\isexe\\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:154:21)',gyp verb `which` failed code: 'ENOENT' }gyp verb check python checking for Python executable "python" in the PATHgyp verb `which` failed Error: not found: pythongyp verb `which` failed at getNotFoundError (E:\trip_user_ui\node_modules\which\which.js:13:12)gyp verb `which` failed at F (E:\trip_user_ui\node_modules\which\which.js:68:19)gyp verb `which` failed at E (E:\trip_user_ui\node_modules\which\which.js:80:29)gyp verb `which` failed at E:\trip_user_ui\node_modules\which\which.js:89:16gyp verb `which` failed at E:\trip_user_ui\node_modules\isexe\index.js:42:5gyp verb `which` failed at E:\trip_user_ui\node_modules\isexe\windows.js:36:5gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)gyp verb `which` failed python { Error: not found: pythongyp verb `which` failed at getNotFoundError (E:\trip_user_ui\node_modules\which\which.js:13:12)gyp verb `which` failed at F (E:\trip_user_ui\node_modules\which\which.js:68:19)gyp verb `which` failed at E (E:\trip_user_ui\node_modules\which\which.js:80:29)gyp verb `which` failed at E:\trip_user_ui\node_modules\which\which.js:89:16gyp verb `which` failed at E:\trip_user_ui\node_modules\isexe\index.js:42:5gyp verb `which` failed at E:\trip_user_ui\node_modules\isexe\windows.js:36:5gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:154:21)gyp verb `which` failed stack:gyp verb `which` failed 'Error: not found: python\n at getNotFoundError (E:\\trip_user_ui\\node_modules\\which\\which.js:13:12)\n at F (E:\\trip_user_ui\\node_modules\\which\\which.js:68:19)\n at E (E:\\trip_user_ui\\node_modules\\which\\which.js:80:29)\n at E:\\trip_user_ui\\node_modules\\which\\which.js:89:16\n at E:\\trip_user_ui\\node_modules\\isexe\\index.js:42:5\n at E:\\trip_user_ui\\node_modules\\isexe\\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:154:21)',gyp verb `which` failed code: 'ENOENT' }gyp verb could not find "python". checking python launchergyp verb could not find "python". guessing locationgyp verb ensuring that file exists: C:\Python27\python.exegyp ERR! configure errorgyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.gyp ERR! stack at PythonFinder.failNoPython (E:\trip_user_ui\node_modules\node-gyp\lib\configure.js:484:19)gyp ERR! stack at PythonFinder.
先前npm install 也是报这种类似的错误
后来搜索出cnpm install node-sass --save这个命令可能有用,但是要事先安装cnpm。所以npm i cnpm时又是一通报错。
所以用npm install -g cnpm --registry=,从淘宝镜像那-,然后cnpm-成功。
最后输入cnpm install node-sass --save。npm run dev终于能跑起来了!!!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~