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

A Strange Syntax Error #321

Open
zejunking opened this issue Feb 7, 2021 · 2 comments
Open

A Strange Syntax Error #321

zejunking opened this issue Feb 7, 2021 · 2 comments

Comments

@zejunking
Copy link

Why?:
The Code will report a strange Syntax Error, but it will run normally after removing const WORK_SPACE = process.cwd();

Code:

const WORK_SPACE = process.cwd();

export async function test(task){
  console.log(';test')
}

export default async function (task) {
  console.log("index taskr");
  await task.clear('compild');
  await task.start('test');
}

ERROR:

export async function test(task){
^^^^^^
SyntaxError: Unexpected token 'export'
    at new Taskr (D:/xxxxx/xxxxx/node_modules/taskr/lib/taskr.js:21:39)
    at Object.<anonymous> (D:/xxxxx/xxxxx/node_modules/taskr/lib/cli/spawn.js:35:9)
    at Generator.next (<anonymous>)
    at Generator.tryCatcher (D:/xxxxx/xxxxx/node_modules/bluebird/js/release/util.js:16:23)      
    at PromiseSpawn._promiseFulfilled (D:/xxxxx/xxxxx/node_modules/bluebird/js/release/generators.js:97:49)

ENV:
node 12.18.3
packages:
"@taskr/clear": "^1.1.0",
"@taskr/esnext": "^1.1.0",
"@taskr/watch": "^1.1.0",
"@vercel/ncc": "^0.27.0",
"node-notifier": "^9.0.0",
"taskr": "^1.1.0",
"typescript": "^4.1.3"

@lukeed
Copy link
Owner

lukeed commented Feb 7, 2021

Hi,

Is this the entire file? I think there may be content before/above const WORK_SPACE = process.cwd(); that's affecting this.

@zejunking
Copy link
Author

Hi,

Is this the entire file? I think there may be content before/above const WORK_SPACE = process.cwd(); that's affecting this.

Yes,this is all.
This is a project that we just initialized.

System: window 10 EE:18363.1316
And:
It seems to be because of the system, but why does this happen?
I can reproduce this error on win10 computer, but not on Mac

There are only two files:
taskfile.js

const WORK_SPACE = process.cwd();

export async function test(task){
  console.log(';test')
}

export default async function (task) {
  console.log("index taskr");
  await task.clear('compild');
  await task.start('test');
}

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "taskr",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@taskr/clear": "^1.1.0",
    "@taskr/esnext": "^1.1.0",
    "@taskr/watch": "^1.1.0",
    "taskr": "^1.1.0"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants