Warning: To load an ES module, set "type": "module"in the package.json or use the .mjs extension. (Use `node --trace-warnings ...` to show where the warning was created)

1146 ワード

Origin Source Code)
{
	...
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@solana/spl-token": "^0.2.0",
    "@solana/web3.js": "^1.36.0"
  }
}
Warning Message)
Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
set "type": "module"in the package.json
package.jsonに「type」:「module」を追加
Solution Source Code)
{
	...
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@solana/spl-token": "^0.2.0",
    "@solana/web3.js": "^1.36.0"
  }
}