编辑sass文件时,我通常使用npm run watch
。
这次npm run watch
行为不端,就像不停地继续工作一样,但那个时候没有错误。当我突然停止它,并在几次运行它后,我无缘无故地得到这个错误。在终止刚刚编辑sass文件的过程后,我没有做任何其他事情。
> @ production D:\Advaith\Laravel\MyBlog
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --
progress --hide-modules --config=node_modules/laravel-
mix/setup/webpack.config.js
undefined:1
SyntaxError: Unexpected end of JSON input
at Object.parse (native)
at Manifest.read (D:\Advaith\Laravel\MyBlog\node_modules\laravel-mix\src\Manifest.js:138:21)
at new Manifest (D:\Advaith\Laravel\MyBlog\node_modules\laravel-mix\src\Manifest.js:9:43)
at Mix.initialize (D:\Advaith\Laravel\MyBlog\node_modules\laravel-mix\src\Mix.js:27:25)
at Object.<anonymous> (D:\Advaith\Laravel\MyBlog\node_modules\laravel-mix\setup\webpack.config.js:35:5)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "E:\\Node Js\\node.exe" "E:\\Node Js\\node_modules\\npm\\bin\\npm-cli.js" "run" "production"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ production: `cross-env NODE_ENV=production
node_modules/webpack/bin/webpack.js --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ production script 'cross-env NODE_ENV=production
node_modules/webpack/bin/webpack.js --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=production
node_modules/webpack/bin/webpack.js --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Advaith\Laravel\MyBlog\npm-debug.log
根据错误我试图更新我的节点和npm。在我使用节点版本v6.6.0
之前,我将其更新为v6.10.2
,但在版本之外的错误中找不到任何更改。
我尝试删除node_molecules
并再次运行npm install
尝试npm cache clear
。
如何解决此错误?
我的package.json
文件看起来像这样
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.15.3",
"bootstrap-sass": "^3.3.7",
"cross-env": "^3.2.3",
"jquery": "^3.1.1",
"laravel-mix": "0.*",
"lodash": "^4.17.4",
"vue": "^2.1.10"
}
}