【发布时间】:2018-09-10 16:50:50
【问题描述】:
在任何版本尝试通过 npm 安装 node-sass 时都会出现错误。知道为什么吗?我试过了:
- 将 node-sass 更新到最新版本
- 将所有内容更新到最新版本并重新格式化 webpack.config.js
- 卸载/删除所有包并重新安装
因此,当我尝试运行 'npm start' 时,我收到错误“找不到模块 'node-sass' 中的错误”
[245] ./src/components/SkiDayCount.js 1.46 kB {0} [built]
[246] ./src/stylesheets/ui.scss 1.17 kB {0} [built] [1 error]
[248] ./~/style-loader/addStyles.js 7.15 kB {0} [built]
ERROR in Cannot find module 'node-sass'
@ ./src/stylesheets/ui.scss 4:14-163
webpack: Failed to compile.
这是我的 package.json。
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "./node_modules/.bin/webpack-dev-server"
},
"author": "",
"license": "MIT",
"devDependencies": {
"autoprefixer-loader": "3.2.0",
"babel-cli": "6.18.0",
"babel-loader": "6.2.5",
"babel-preset-latest": "6.16.0",
"babel-preset-react": "6.16.0",
"babel-preset-stage-0": "6.16.0",
"css-loader": "0.25.0",
"json-loader": "0.5.4",
"node-sass": "3.10.1",
"sass-loader": "4.0.2",
"style-loader": "0.13.1",
"webpack": "1.13.3",
"webpack-dev-server": "1.16.2"
},
"dependencies": {
"react": "15.3.2",
"react-dom": "15.3.2"
}
}
【问题讨论】:
-
尝试错误中提到的完整日志
-
试试
sudo npm install...可能是权限问题。 -
也许这会有所帮助
npm cache clean
标签: reactjs npm webpack package.json node-sass