构建错误:找不到咖啡标注模块
Hi所有,我得到这个构建错误
"./node_modules/vm2/lib/compiler.js
模块找不到 : 无法解析 '/Users/me/my-project/node_moles/vm2/lib'
并准备上传图像 Api路由看起来像:
import { NextRequest, NextResponse } from 'next/server' import {v2 as cloudinary} from 'cloudinary' const UPLOAD_IMAGE_URL = process.env.UPLOAD_IMAGE_URL export async function POST( req, res) { try { const formData = req.body //cloudinary upload logic goes here return NextResponse.json({ message: 'Hello Everyone!' }) } catch (e){ console.log(e) return NextResponse.json({message: 'failed'}) } }
一号
答案解析
-
顿
报错似乎与Vm2包中缺失模块“coffee-script”相关几步解决问题
确定新版节点安装可运行查看当前节点js版本
节点-五
内端使用过期版本时,考虑升级最新稳定发布删除
节点模式
文件夹重新安装依赖关系可用终端运行下列命令实现 :m-rf节点npm安装
重置依存性后问题持久化,Vm2包有可能有依存冲突Vm2软件包可明文更新到特定版本终端运行
m安装vm2
安装最新版本vm2包
上方步骤解决不了问题, 包包本身可能与vm2有依赖冲突 。可强制使用特殊版本vm2Vm2版本3.7.0
m安装[email protected]
并试运行程序并查看错误是否持久
如果这些步骤都无济于事,请提供使用中具体版本的cloudiary和vm2包,并提供任何附加错误消息或栈迹信息帮助深入调查并帮助你解决问题
0 -
感谢响应刚试上方所有步骤, 问题仍然存在, 以下是我运行的具体版本:
特殊性:+1.37.1
Vm2:+37.0
下图13.4.2
类型标注:5.0.4
试编译时报错
./node_modules/degenerator/node_modules/vm2/lib/compiler.js Module not found: Can't resolve 'coffee-script' in '/Users/me/my-project/node_modules/degenerator/node_modules/vm2/lib' Import trace for requested module: ./node_modules/degenerator/node_modules/vm2/lib/compiler.js ./node_modules/degenerator/node_modules/vm2/lib/script.js ./node_modules/degenerator/node_modules/vm2/lib/main.js ./node_modules/degenerator/node_modules/vm2/index.js ./node_modules/degenerator/dist/src/index.js ./node_modules/pac-resolver/dist/index.js ./node_modules/pac-proxy-agent/dist/agent.js ./node_modules/pac-proxy-agent/dist/index.js ./node_modules/proxy-agent/index.js ./node_modules/cloudinary/lib/utils/index.js ./node_modules/cloudinary/lib/utils/srcsetUtils.js ./node_modules/cloudinary/lib/cloudinary.js ./node_modules/cloudinary/cloudinary.js ./app/api/image/route.tsx ./node_modules/degenerator/node_modules/vm2/lib/resolver-compat.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ./node_modules/degenerator/node_modules/vm2/lib/resolver-compat.js ./node_modules/degenerator/node_modules/vm2/lib/main.js ./node_modules/degenerator/node_modules/vm2/index.js ./node_modules/degenerator/dist/src/index.js ./node_modules/pac-resolver/dist/index.js ./node_modules/pac-proxy-agent/dist/agent.js ./node_modules/pac-proxy-agent/dist/index.js ./node_modules/proxy-agent/index.js ./node_modules/cloudinary/lib/utils/index.js ./node_modules/cloudinary/lib/utils/srcsetUtils.js ./node_modules/cloudinary/lib/cloudinary.js ./node_modules/cloudinary/cloudinary.js ./app/api/image/route.tsx - info Linting and checking validity of types - info Collecting page data ..Error: ENOENT: no such file or directory, open '/Users/me/my-project/.next/server/chunks/bridge.js' at Object.openSync (node:fs:601:3) at Object.readFileSync (node:fs:469:35) at 78475 (/Users/me/my-project/.next/server/chunks/473.js:54037:120) at __webpack_require__ (/Users/me/my-project/.next/server/webpack-runtime.js:25:43) at 86577 (/Users/me/my-project/.next/server/chunks/473.js:51797:17) at __webpack_require__ (/Users/me/my-project/.next/server/webpack-runtime.js:25:43) at 40117 (/Users/me/my-project/.next/server/chunks/473.js:50554:18) at __webpack_require__ (/Users/me/my-project/.next/server/webpack-runtime.js:25:43) at 88436 (/Users/me/my-project/.next/server/chunks/473.js:50382:15) at __webpack_require__ (/Users/me/my-project/.next/server/webpack-runtime.js:25:43) { errno: -2, syscall: 'open', code: 'ENOENT', path: '/Users/me/my-project/.next/server/chunks/bridge.js' } > Build error occurred Error: Failed to collect page data for /api/image at /Users/me/my-project/node_modules/next/dist/build/utils.js:1152:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { type: 'Error' }
以防有帮助,这里是安装vm2@latest后我得到的编译错误
./node_modules/vm2/lib/compiler.js Module not found: Can't resolve 'coffee-script' in '/Users/me/my-project/node_modules/vm2/lib' Import trace for requested module: ./node_modules/vm2/lib/compiler.js ./node_modules/vm2/lib/script.js ./node_modules/vm2/lib/main.js ./node_modules/vm2/index.js ./node_modules/degenerator/dist/src/index.js ./node_modules/pac-resolver/dist/index.js ./node_modules/pac-proxy-agent/dist/agent.js ./node_modules/pac-proxy-agent/dist/index.js ./node_modules/proxy-agent/index.js ./node_modules/cloudinary/lib/utils/index.js ./node_modules/cloudinary/lib/utils/srcsetUtils.js ./node_modules/cloudinary/lib/cloudinary.js ./node_modules/cloudinary/cloudinary.js ./app/api/image/route.tsx ./node_modules/vm2/lib/resolver-compat.js Critical dependency: the request of a dependency is an expression Import trace for requested module: ./node_modules/vm2/lib/resolver-compat.js ./node_modules/vm2/lib/main.js ./node_modules/vm2/index.js ./node_modules/degenerator/dist/src/index.js ./node_modules/pac-resolver/dist/index.js ./node_modules/pac-proxy-agent/dist/agent.js ./node_modules/pac-proxy-agent/dist/index.js ./node_modules/proxy-agent/index.js ./node_modules/cloudinary/lib/utils/index.js ./node_modules/cloudinary/lib/utils/srcsetUtils.js ./node_modules/cloudinary/lib/cloudinary.js ./node_modules/cloudinary/cloudinary.js ./app/api/image/route.tsx - info Linting and checking validity of types - info Collecting page data ..Error: ENOENT: no such file or directory, open '/Users/me/my-project/.next/server/chunks/bridge.js' at Object.openSync (node:fs:601:3) at Object.readFileSync (node:fs:469:35) at 90260 (/Users/me/my-project/.next/server/chunks/473.js:85507:120) at __webpack_require__ (/Users/me/my-project/.next/server/webpack-runtime.js:25:43) at 63232 (/Users/me/my-project/.next/server/chunks/473.js:83267:17) at __webpack_require__ (/Users/me/my-project/.next/server/webpack-runtime.js:25:43) at 34088 (/Users/me/my-project/.next/server/chunks/473.js:82024:18) at __webpack_require__ (/Users/me/my-project/.next/server/webpack-runtime.js:25:43) at 88436 (/Users/me/my-project/.next/server/chunks/473.js:50382:15) at __webpack_require__ (/Users/me/my-project/.next/server/webpack-runtime.js:25:43) { errno: -2, syscall: 'open', code: 'ENOENT', path: '/Users/me/my-project/.next/server/chunks/bridge.js' } > Build error occurred Error: Failed to collect page data for /api/image at /Users/me/my-project/node_modules/next/dist/build/utils.js:1152:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { type: 'Error' }
0 -
台阶安装后我仍面临同样的问题
咖啡条
人工操作问题更新以下是我当前搭建
节点:18.16.0
云度:137.2
接者:13.4.3
0 -
0
-
感谢Tamara前往主题线程
0 -
使用Next.js我将尝试通过基本HTTP请求实现它而不是SDK至少在问题解决前
0