![](/img/trans.png)
[英]wrangler dev seems to work, but wrangler publish doesn't work, gets error "Unexpected token p in JSON at position 0"
[英]Cloudflare pages worker error when running wrangler dev
我正在關注本教程(讓 cloudflare 頁面與動物 db 一起使用),但是當我進入“測試和部署 Worker”一章並嘗試運行wrangler dev
(它將運行npm run build
,然后運行worktop build index.js
)我收到錯誤消息sh: worktop: command not found
。
我仔細檢查了我是否正確執行了每個步驟,檢查了node_modules
目錄中是否存在worktop
(它是),並且還嘗試全局安裝worktop
(沒有工作)。
我在這里想念什么?
運行wrangler dev
的完整 output :
$ wrangler dev
🌀 Running npm run build
> fauna-demo-workers@1.0.0 build /Users/me/dev/fauna-demo-workers
> worktop build index.js
sh: worktop: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! fauna-demo-workers@1.0.0 build: `worktop build index.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the fauna-demo-workers@1.0.0 build 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! /Users/me/.npm/_logs/2022-01-09T12_54_24_718Z-debug.log
Error: Build failed! Status Code: 1
你必須安裝worktop.build
package。 這就是worktop
二進制文件的來源。 稱為“worktop”的 package 只是一個運行時庫。 不是每個人都想使用它自以為是的 CLI/builder,因此單獨的 package。
(我是worktop & worktop.build的作者)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.