Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module parse failed: Octal literal in strict mode (61:65) #43930

Closed
1 task done
alexmf91 opened this issue Dec 10, 2022 · 10 comments
Closed
1 task done

Module parse failed: Octal literal in strict mode (61:65) #43930

alexmf91 opened this issue Dec 10, 2022 · 10 comments
Assignees
Labels
bug Issue was opened via the bug report template. locked SWC Related to minification/transpilation in Next.js.

Comments

@alexmf91
Copy link

alexmf91 commented Dec 10, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Wed Mar 2 00:30:59 UTC 2022
Binaries:
  Node: 16.14.2
  npm: 8.5.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant packages:
  next: 13.0.6
  eslint-config-next: 13.0.6
  react: 18.2.0
  react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://github.com/alexmf91/eth-solidity-web3/tree/master/crowd-coin

To Reproduce

Server component that throws the error:

import factory from '@crowd-coin/ethereum/factory'
import CampaignsList from './components/CampaignList'

const getCampaigns = async () => {
  const campaigns = await factory.methods.getDeployedCampaigns().call()
  return campaigns
}

export default async function Campaigns() {
  const campaigns = await getCampaigns()

  return (
    <div>
      <p>Home Page app campaigns {JSON.stringify(campaigns)}</p>
      <CampaignsList items={campaigns} />
    </div>
  )
}

Client component that works as spected:

'use client'

import { useEffect } from 'react'
import factory from '@crowd-coin/ethereum/factory'

export default function CampaignsList({ items }: any) {
  const campaigns = 'await getCampaigns()'
  useEffect(() => {
    async function getCampaigns() {
      const campaigns = await factory.methods.getDeployedCampaigns().call()
      console.log('Campaings', campaigns)
    }
    getCampaigns()
  }, [])

  return <p>CampaignsList component {JSON.stringify(items)}</p>
}

Web3 lib config:

import Web3 from 'web3'

let web3

if (typeof window !== 'undefined' && typeof window.ethereum !== 'undefined') {
  console.log('Web3 browser instance')
  // We are in the browser and metamask is running.
  window.ethereum.request({ method: 'eth_requestAccounts' })
  web3 = new Web3(window.ethereum)
} else {
  console.log('Web3 server instance')
  // We are on the server *OR* the user is not running metamask
  const provider = new Web3.providers.HttpProvider(
    'https://goerli.infura.io/v3/APIKEY'
  )
  web3 = new Web3(provider)
}

export default web3

Describe the Bug

When I run the dev server with a call to web3 in the server it throws me the following error:

error - ./node_modules/tar/lib/header.js
Module parse failed: Octal literal in strict mode (61:65)
File was processed with these loaders:
 * ./node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
 * ./node_modules/next/dist/build/webpack/loaders/next-swc-loader.js
You may need an additional loader to handle the result of these loaders.
|         if (this[TYPE] === "5") this.size = 0;
|         this.linkpath = decString(buf, off + 157, 100);
>         if (buf.slice(off + 257, off + 265).toString() === "ustar\000") {
|             this.uname = decString(buf, off + 265, 32);
|             this.gname = decString(buf, off + 297, 32);

Expected Behavior

I expect to be able to build properly the dev server, and run the function in server side as runs in client side.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@alexmf91 alexmf91 added the bug Issue was opened via the bug report template. label Dec 10, 2022
@alexmf91
Copy link
Author

Some help would be nice. Thx

@JonCognioDigital
Copy link

I am getting a similar error (Module parse failed: Octal literal in strict mode) with the most basic app/layout.tsx and app/page.tsx

@hc0503
Copy link

hc0503 commented Apr 8, 2023

I am getting a same error after upgrading the version 13.3.0 in app directory beta version.

If I make client component with 'use client', that shows the error.

@Alldrich
Copy link

Alldrich commented Apr 8, 2023

I am getting same error after upgrading to 13.3.0.

@RETOVSKEJ
Copy link

same in 13.3.1

@ccweerasinghe1994
Copy link

I am getting same error after in 13.3.0.

@namln2k
Copy link

namln2k commented Apr 21, 2023

I am getting the same error with Next.js 13.3.0
I found an answer on Stackoverflow, which seems weird but works.
That guy just changes from
export default function RootLayout() { /** ... */ }
to
function RootLayout() { /** ... */ } export default RootLayout

@kdy1 kdy1 self-assigned this Jan 28, 2024
@kdy1
Copy link
Member

kdy1 commented Jan 30, 2024

This should be fixed on the latest canary.

@kdy1 kdy1 added the SWC Related to minification/transpilation in Next.js. label Jan 30, 2024
@kdy1
Copy link
Member

kdy1 commented Jan 31, 2024

Closing as fixed

@kdy1 kdy1 closed this as completed Jan 31, 2024
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

No branches or pull requests

8 participants