我正在尝试从Laravel-Vue项目中的Windows命令行执行npm run watch
。我使用以下内容:
这是我的 的的package.json:
{
"private": true,
"devDependencies": {
"watchify": "^1.0.6",
"bootstrap-sass": "^3.0.0",
"laravel-elixir": "^2.0.0",
"coffee-script": "^1.8.0",
"coffeeify": "^1.1.0",
"gulp": "^3.8.8",
"gulp-clean-css": "*",
"stringify": "^3.1.0",
"vue": "*"
},
"scripts": {
"watch": "watchify -v -t coffeeify -t stringify resources/assets/js/app.js -o public/js/bundle.js",
"build": "browserify -v -t coffeeify -t stringify resources/assets/js/app.js -o public/js/bundle.js"
}
}
每当我运行命令时,我都会收到以下错误:
> @ watch C:\xampp\htdocs\software_vue
> watchify -v -t coffeeify -t stringify resources/assets/js/app.js -o public/js/bundle.js
path.js:7
throw new TypeError('Path must be a string. Received ' + inspect(path));
^
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.dirname (path.js:695:5)
at Deps.lookupPackage (C:\xampp\htdocs\software_vue\node_modules\module-deps\index.js:452:29)
at Deps._transform (C:\xampp\htdocs\software_vue\node_modules\module-deps\index.js:93:10)
at Deps.Transform._read (C:\xampp\htdocs\software_vue\node_modules\readable-stream\lib\_stream_transform.js:184:10)
at Deps.Transform._write (C:\xampp\htdocs\software_vue\node_modules\readable-stream\lib\_stream_transform.js:172:12)
at Labeled.Pipeline._write (C:\xampp\htdocs\software_vue\node_modules\stream-splicer\index.js:73:22)
at doWrite (C:\xampp\htdocs\software_vue\node_modules\readable-stream\lib\_stream_writable.js:279:12)
at writeOrBuffer (C:\xampp\htdocs\software_vue\node_modules\readable-stream\lib\_stream_writable.js:266:5)
at Labeled.Writable.write (C:\xampp\htdocs\software_vue\node_modules\readable-stream\lib\_stream_writable.js:211:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `watchify -v -t coffeeify -t stringify resources/assets/js/app.js -o public/js/bundle.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Debarun Pal\AppData\Roaming\npm-cache\_logs\2017-10-09T10_17_15_209Z-debug.log
调试日志转储
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'cache',
1 verbose cli 'clean' ]
2 info using npm@5.5.1
3 info using node@v7.10.0
4 verbose npm-session 1bde4f10d2ea77e8
5 verbose stack Error: As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
5 verbose stack
5 verbose stack If you're sure you want to delete the entire cache, rerun this command with --force.
5 verbose stack at clean (C:\Program Files\nodejs\node_modules\npm\lib\cache.js:70:22)
5 verbose stack at EventEmitter.cache (C:\Program Files\nodejs\node_modules\npm\lib\cache.js:45:16)
5 verbose stack at Object.commandCache.(anonymous function) (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:149:13)
5 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:84:30)
5 verbose stack at _combinedTickCallback (internal/process/next_tick.js:73:7)
5 verbose stack at process._tickCallback (internal/process/next_tick.js:104:9)
6 verbose cwd C:\xampp\htdocs\software_vue
7 verbose Windows_NT 10.0.15063
8 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "cache" "clean"
9 verbose node v7.10.0
10 verbose npm v5.5.1
11 error As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
11 error
11 error If you're sure you want to delete the entire cache, rerun this command with --force.
12 verbose exit [ 1, true ]
我无法追溯到这个问题,有点丢失,而是从哪里开始调试。