I am getting these errors when i run gulp command. what is causing this?
SyntaxError: Unexpected token :
at exports.runInThisContext (vm.js:54:16)
at Module._compile (module.js:375:25)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at execute (/usr/local/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/index.js:23:3)
at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp-cli/index.js:150:63)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp-cli/node_modules/liftoff/index.js:192:16)
That looks like a : instead of ; in your gulpfile.js on line 29.
Related
Whenever I'm running a command with npm. it's giving an Error. A few days ago, It was totally fine. I used it in some of my projects but now it is can't do nothing.
node:internal/modules/cjs/loader:941
const err = new Error(message);
^
Error: Cannot find module '../../package.json'
Require stack:
- C:\Users\nuur hassan\AppData\Roaming\npm\node_modules\npm\lib\utils\unsupported.js
- C:\Users\nuur hassan\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\nuur hassan\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
at Function.Module._load (node:internal/modules/cjs/loader:774:27)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (C:\Users\nuur hassan\AppData\Roaming\npm\node_modules\npm\lib\utils\unsupported.js:2:19)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\nuur hassan\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\utils\\unsupported.js',
'C:\\Users\\nuur hassan\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js',
'C:\\Users\\nuur hassan\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'
]
}
The error says that npm can't find the package.json file. Make sure you haven't deleted it. If you want to create one you can use npm init to initialize one in the current directory. Even if that fails I'd reinstall node js and double check the NODE_PATH.
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'better-sqlite3'
Require stack:
- D:\UserProfile\Users\Administrator\Desktop\rosbot\src\utils\db.js
- D:\UserProfile\Users\Administrator\Desktop\rosbot\src\Client.js
- D:\UserProfile\Users\Administrator\Desktop\rosbot\app.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (D:\UserProfile\Users\Administrator\Desktop\rosbot\src\utils\db.js:1:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\UserProfile\\Users\\Administrator\\Desktop\\rosbot\\src\\utils\\db.js',
'D:\\UserProfile\\Users\\Administrator\\Desktop\\rosbot\\src\\Client.js',
'D:\\UserProfile\\Users\\Administrator\\Desktop\\rosbot\\app.js'
]
}
I am getting this error when I am trying to run the discord bot with vscode by the command "node ." and I don't know how to solve this
Looks like you haven't Imported the module or named it wrong or installed
example to fix importing error:
const <name> = require("better-sqlite3");
example to fix name error:
const <name> = require("better-sqlite3");
example to fix installing error:
in cmd type: npm i better-sqlite3
after that type
const <name> = require("better-sqlite3")
change name with what you want it to be as.
Here is the error that I get every time I try to execute the code and I can't find a solution so please help.
PS C:\Users\boble\OneDrive\Desktop\ScriptsNStuff\karmik> node .
node:internal/modules/cjs/loader:927
throw err;
^
Error: Cannot find module './config.json'
Require stack:
- C:\Users\boble\OneDrive\Desktop\ScriptsNStuff\karmik\commands\Test.js
- C:\Users\boble\OneDrive\Desktop\ScriptsNStuff\karmik\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\boble\OneDrive\Desktop\ScriptsNStuff\karmik\commands\Test.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\boble\\OneDrive\\Desktop\\ScriptsNStuff\\karmik\\commands\\Test.js',
'C:\\Users\\boble\\OneDrive\\Desktop\\ScriptsNStuff\\karmik\\index.js'
When I run my Rails 6.0 application on development environment I get the next trace on the development.log
[Webpacker] Compiling…
[Webpacker] Compilation failed:
/home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js:93
throw err;
^
Error: Cannot find module '#rails/webpacker'
Require stack:
- /mnt/config/webpack/environment.js
- /mnt/config/webpack/development.js
- /home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js
- /home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js
- /home/alejo/rails_project/node_modules/webpack/bin/webpack.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:954:17)
at Function.Module._load (internal/modules/cjs/loader.js:847:27)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/mnt/config/webpack/environment.js:1:87)
at Module._compile (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/mnt/config/webpack/development.js:3:21)
at Module._compile (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Module.require (internal/modules/cjs/loader.js:1016:19)
at require (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at WEBPACK_OPTIONS (/home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13)
at requireConfig (/home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6)
at /home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
at Array.forEach (<anonymous>)
at module.exports (/home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)
at /home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js:71:45
at Object.parse (/home/alejo/rails_project/node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18)
at /home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js:49:8
at Object.<anonymous> (/home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:1121:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/mnt/config/webpack/environment.js',
'/mnt/config/webpack/development.js',
'/home/alejo/rails_project/node_modules/webpack-cli/bin/utils/convert-argv.js',
'/home/alejo/rails_project/node_modules/webpack-cli/bin/cli.js',
'/home/alejo/rails_project/node_modules/webpack/bin/webpack.js'
]
}
I am using webpacker 4.0.7, rails 6.0.0 and ruby 2.6.5
I want to know why am I getting this error and how do I solve it.
Thank you
I ran into this issue as well. For me, the issue was the node version (13.6.0). I figured this out by running yarn add #rails/webpacker, which returned the error Expected version "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7". Got "13.6.0"
To fix it:
Update node to an appropriate version (see error above)
Delete node_modules directory
Update yarn files with yarn install --check-files
Install webpacker with rails webpacker:install
Confirm it worked by bin/webpack-dev-server and getting no errors
I am writing the below test cases using Mocha in node.js. Please find the below code :
describe('Car', function() {
it('can park?',function()
{
const car = new Car();
assert.equal(car.park(),'stopped'); }); });
I am running this using following command :
npm run test
It populates following error :
> inbox#1.0.0 test /Users/abc/test/
> mocha
/Users/abc/test/Inbox.test.js:18
describe('Car', function() {
^^^^^
SyntaxError: Unexpected string
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
Can you please help me, what i am doing wrong here?
Note : package.json is also updated with mocha in scripts field.
I know i am answering to my own question but its more like recording it for others.
Just Use following statement in your code at top or before describe statements
"use strict";