前提・実現したいこと
jsファイル実行するとエラーがでるので、解消したい。
発生している問題・エラーメッセージ
command
>node index.js node:internal/modules/cjs/loader:488 throw e; ^ Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/sync' is not defined by "exports" in C:\Users\xlost\work\TypeScript\test-api\node_modules\csv-stringify\package.json }
該当のソースコード
JavaScript
// Youtube APIをコールするのに利用 const { google } = require("googleapis"); const apiKey = "*******"; const youtube = google.youtube({ version: "v3", auth: apiKey }); const iconv = require("iconv-lite"); // 日時のライブラリ const moment = require("moment"); // CSV書き出しに利用 const fs = require("fs"); const stringify = require("csv-stringify/lib/sync"); !!エラー箇所 const { serialize } = require("v8");
試したこと
該当のモジュールをディレクトリ配下でsyncを確認。
\node_modules\csv-stringify\lib\sync.js
\node_modules\csv-stringify\lib\sync.d.ts
また、エラー行の前で定義している\node_modules\googleapisも確認。
補足情報(FW/ツールのバージョンなど)
・node v16.14.0
・package-lock.json
{
"name": "test-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"csv": "^6.0.5",
"csv-stringify": "^6.0.5",
"googleapis": "^95.0.0",
"iconv-lite": "^0.6.3",
"moment": "^2.29.1"
}
}
まだ回答がついていません
会員登録して回答してみよう