我有一个在Windows 10上本地运行的节点项目。当我执行npm run start时,它挂在“ npm run sass”之后,没有错误消息,并且从不运行browsersync。如果我分别运行“ npm run browsersync”和“ npm run sass”,它们就可以正常工作。问题是我的css映射无法正常工作,我认为这可能是问题的一部分。还有一个问题是,保存我的scss时,sass编译器有时会一直不停地运行。
我的package.json看起来像这样:
{
"name": "sassy-bootstrap-boilerplate",
"version": "1.0.0",
"description": "Lean Boilerplate",
"main": "index.js",
"scripts": {
"sass": "node-sass -w dist/assets/styles dist/assets/styles/base dist/assets/styles/components dist/assets/styles/pages -o dist/assets/styles --source-map true --output-style compressed",
"removeCSS": "rm dist/assets/styles/*.css dist/assets/styles/*.css.map",
"browsersync": "node index.js",
"webp": "node webp.js",
"critical": "node penthouse.js",
"start": "npm run removeCSS && npm run sass && npm run browsersync",
"start2": "npm run browsersync",
"start3": "npm run browsersync & npm run removeCSS & npm run sass"
},
"author": "Elke Freed",
"license": "ISC",
"dependencies": {
"animate.css": "^3.7.2",
"flickity": "^2.2.1",
"penthouse": "^2.2.0",
"sal.js": "^0.6.1"
},
"devDependencies": {
"bootstrap": "^4.3.1",
"browser-sync": "^2.26.7",
"bs-html-injector": "^3.0.3",
"imagemin": "^6.0.0",
"imagemin-webp": "^5.0.0",
"node-sass": "^4.12.0"
},
"repository": {
"type": "git",
"url": "https://github.com/myurl/Sassy-Bootstrap-Boilerplate.git"
}
}
index.js是
//bs.js
var bs = require('browser-sync').create();
bs.init({
server: "dist",
files: ["dist/assets/styles/*.css"],
notify: false,
plugins: [
{
module: "bs-html-injector",
options: {
files: ["dist/*.html"]
}
}
]
});
一旦我运行脚本,它就永远不会启动browsersync并且本地服务器也不会启动。最后的输出是:
node-sass -w dist / assets / styles dist / assets / styles / base dist / assets / styles / components dist / assets / styles / pages -o dist / assets / styles --source-map true-输出样式已压缩
我该如何调试?我在任何地方都看不到任何日志或错误。