I am encountering an error when running docusaurus build on docusaurus#1.5.1 and Node 6:
$ docusaurus-build
/home/website/node_modules/docusaurus/lib/build-files.js:31
);
^
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
Basically there is code like this currently in Docusaurus:
console.log(
chalk.red('hello world'),
);
How do I fix it?
That error occurs because trailing commas in function calls are not supported in older versions of Node. Ensure that you are using a Node version that is 8 and above. As of Docusaurus 1.2.0, Node 6 is not supported anymore and the minimum supported version is Node 8. As stated in the documentation:
You have to be on Node >= 8.x and Yarn >= 1.5.
You could use a tool like nvm to manage your Node versions.
Related
enter image description here
C:\Users\DELL\nft_marketplace>npx hardhat test
You are using a version of Node.js that is not supported by Hardhat, and it may work incorrectly, or not work at all.
Please, make sure you are using a supported version of Node.js.
To learn more about which versions of Node.js are supported go to https://hardhat.org/nodejs-versions
An unexpected error occurred:
C:\Users\DELL\nft_marketplace\hardhat.config.js:10
mumbai: {
^^^^^^
SyntaxError: Unexpected identifier
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1027:15)
at Module._compile (node:internal/modules/cjs/loader:1063:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at importCsjOrEsModule (C:\Users\DELL\nft_marketplace\node_modules\hardhat\src\internal\core\config\config-loading.ts:24:20)
at loadConfigAndTasks (C:\Users\DELL\nft_marketplace\node_modules\hardhat\src\internal\core\config\config-loading.ts:76:18)
C:\Users\DELL\nft_marketplace>node -v
v17.9.0
I installed the module "koa-cache-control" via npm.
I added the following lines to my index.js.
const cacheControl = require('koa-cache-control');
Then...
app.use(cacheControl({
noCache: true
}));
Here is the error I get when starting node.
Any clues?
AssertionError: app.use() requires a generator function
at Application.app.use
(/home/www/node_modules/koa/lib/application.js:106:5)
at Object.<anonymous> (/home/www/index.js:17:5)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
Thanks!
You seem to be using an old version of Koa. The 1.x versions used a generator-based type of middleware, which was changed to Promises in version 2.
You'll either have to update Koa or use the old version 1.0.0 of koa-cache-control.
serve -s build is causing the following error. Why is it an unexpected identifier when it's an argument? Thank you for your help
const updateCheck = async isDebugging => (
^^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
My system is
System Version: macOS 10.13.4 (17E199)
Kernel Version: Darwin 17.5.0
Boot Volume: Macintosh HD
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 5 days 8:33
and I am using
node --version v6.10.3
yarn --version 0.27.5
Updating your node version to the LTS edition will resolve your issue.
I tried to launch first example from official documentation here
https://github.com/cucumber/cucumber-js/blob/master/docs/nodejs_example.md
I used Windows 7x64 bit , node.js 6.11
I tried the following commands and got the same result
*
node_modules/cucumber/bin/cucumber.js autotests/cucumber-test/features/documentation.feature
node_modules\cucumber\bin\cucumber.js autotests\cucumber-test\features\documentation.feature
cucumber autotests\cucumber-test\features\documentation.feature
cucumber-js autotests\cucumber-test\features\documentation.feature
*
and I got the following error
cucumber.js:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at getDefinitions (<path>\node_modules\cucumber\lib\cucumber\cli\profiles_loader.js:8:23)
I also tried to downgrade to cucumber 1.3.3 but it doesn't help
Please try below command:
node_modules\cucumber\bin\cucumber.js.cmd autotests\cucumber-test\features\documentation.feature
I found solution
1) npm init -> and define package.json
2) npm install cucumber#latest
3) node_modules\.bin\cucumber.js.cmd <path>\myfeature.feature
I have a JavaScript file that I could run just fine yesterday. I reinstalled Windows last night, reinstalled Node this morning, and I'm trying to run the same JavaScript file now, but its giving me an error.
$ node index.js
C:\Users\<user-name>\Google Drive\Projects\<blah>-coding\index.js:1
(function (exports, require, module, __filename, __dirname) {
SyntaxError: Invalid or unexpected token
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
code is Unicode and not working, just save as UTF-8, working great!