Gulp AssertionError [ERR_ASSERTION]: , how to specify task function? - javascript

I am leaning Golang from gorestful.
I am trying to reproduce this project on my Ubuntu 18.04.
If I go for
gulp
from command line
assert.js:42
throw new errors.AssertionError({
^
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (/home/milenko/node_modules/undertaker/lib/set-task.js:10:3)
at Gulp.task (/home/milenko/node_modules/undertaker/lib/task.js:13:8)
at Object.<anonymous> (/home/milenko/go/src/github.com/MilenkoM/gulpfile.js:10:6)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
How to solve this?
gulp -v
[19:51:51] CLI version 3.9.1
[19:51:51] Local version 4.0.0
My gulpfile.js
var gulp = require("gulp");
var shell = require('gulp-shell');
// This compiles new binary with source change
gulp.task("install-binary", shell.task([
'go install github.com/MilenkoM/romanserver'
]));
// Second argument tells install-binary is a deapendency for restart-supervisor
gulp.task("restart-supervisor", ["install-binary"], shell.task([
'supervisorctl restart myserver'
]))
gulp.task('watch', function() {
// Watch the source code for all changes
gulp.watch("*", ['install-binary', 'restart-supervisor']);
});
gulp.task('default', ['watch']);
My tree
~/go/src/github.com/MilenkoM$ tree .
.
├── gulpfile.js
├── romanNumerals
│ └── data.go
└── romanserver
└── main.go

Related

NODE [ERR_MODULE_NOT_FOUND]: Cannot find module './config/app'

FIXED, the names of the folders in my pc changed when uploaded to github
So, my app looks something like this
├── config
| ├── app.js
|
└── index.js
app.js
Here i have all my env variables, so I have a central point from which to extract them
require('dotenv').config()
module.exports = {
appPort: process.env.PORT,
appUrl: process.env.APP_URL,
appKey: process.env.APP_KEY,
frontendUrl: process.env.FRONTEND_URL
}
index.js
central file of the server
const express = require('express')
const cors = require('cors')
const app = express()
const { appPort, frontendUrl } = require('./config/app')
app.listen(appPort , () => {
console.log(`Server listening on port ${appPort}`);
})
The problem here is that when i deploy it and starts the server, it throws me error
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './config/app'
Require stack:
- /app/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/app/index.js:8:34)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/app/index.js' ]
}
and i really don't know why, because it works perfectly fine in my pc
the code for the whole project is actually much bigger, but only this files are the ones throwing me errors
Hope someone can help see what is happening that throws that error

node_modules error: missing module postcss, when is present in node_modules/.bin

I'm trying to run a package.json script (with yarn) however it seems to fail due to a missing module. However when checking node modules it seems the relevant module is there, so I'm not clear how to resolve the error.
~/P/j/tw-tutorial ❯❯❯ yarn build:css
yarn run v1.22.4
$ postcss src/css/tailwind.css -o src/css/main.css
internal/modules/cjs/loader.js:955
throw err;
^
Error: Cannot find module '../'
Require stack:
- /Users/yunti/Projects/js/tw-tutorial/node_modules/.bin/postcss
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15)
at Function.Module._load (internal/modules/cjs/loader.js:835:27)
at Module.require (internal/modules/cjs/loader.js:1012:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/yunti/Projects/js/tw-tutorial/node_modules/.bin/postcss:3:1)
at Module._compile (internal/modules/cjs/loader.js:1123:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:972:32)
at Function.Module._load (internal/modules/cjs/loader.js:872:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Users/yunti/Projects/js/tw-tutorial/node_modules/.bin/postcss' ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
~/P/j/tw-tutorial ❯❯❯ postcss src/css/tailwind.css -o src/css/main.css
fish: Unknown command: postcss
~/P/j/tw-tutorial ❯❯❯ npx postcss src/css/tailwind.css -o src/css/main.css
Cannot find module '../'
Require stack:
- /Users/yunti/Projects/js/tw-tutorial/node_modules/.bin/postcss
~/P/j/tw-tutorial ❯❯❯ ll ./node_modules/.bin | grep postcss
-rwxr-xr-x 1 yunti staff 36B 24 Apr 10:20 postcss
update looks like the error is coming from postcss (not because postcss can't be found) as
postcss.config.js
module.exports = {
plugins:[
require('tailwindcss'),
require('autoprefixer'),
process.env.NODE_ENV === 'production' && require('#fullhuman/postcss-purgecss')({
content: [
'.src/**/*.js',
'.src/**/*.jsx',
'./public/index.html',
],
defaultExtractor: content=> content.match(/[A-Za-z0-9-_:/]+/g) || []
})
],
};

GulpJS: Assertion Error when trying to automate all tasks to form CSS files from SASS files

I have a problem regarding my task automation. I am using gulpJS and my css used is gulp-sass. I tried to learn this from a youtube video I found online -> https://www.youtube.com/watch?v=LYbt50dhTko and my main problem is, I tried to automate my css so that I won't have a hard time compiling both my css and sass files but I always get an error that says:
assert.js:339
throw err;
^
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask]
(C:\Users\Applicant\Documents\responsive_screen\node_modules\undertaker\lib\set-task.js:10:3)
at Gulp.task
(C:\Users\Applicant\Documents\responsive_screen\node_modules\undertaker\lib\task.js:13:8)
at Object.<anonymous> (C:\Users\Applicant\Documents\responsive_screen\gulpfile.js:22:6)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
This is my first time coding in gulp js and I really want to learn this one. I will post my source code below this paragraph:
var gulp = require('gulp');
var sass = require('gulp-sass');
var uglifycss = require('gulp-uglifycss');
var watch = require('gulp-watch');
gulp.task('css', function(){
gulp.src('./css/*.css')
.pipe(uglifycss({
"maxLineLen": 80,
"uglyComments" : true
}))
.pipe(gulp.dest('./dist/'));
});
gulp.task('sass', function () {
return gulp.src('./sass/*.scss')
.pipe(sass.sync().on('error', sass.logError))
.pipe(gulp.dest('./css'));
});
gulp.task('run', ['sass', 'css']);
gulp.task('watch', function(){
gulp.watch('./sass/*.scss', ['sass']);
gulp.watch('./css/*.css', ['css']);
});
gulp.task('default', ['run', 'watch']);
Can someone share solutions or ideas to this problem? It would be very much appreciated!

Mocha 6, Babel 7, ES6: SyntaxError: Unexpected token export

I'm trying to create a simple npm package based on another called 'sidebar-v2' (https://github.com/Turbo87/sidebar-v2)
For that reason, I've tried to update the JS code to ES6, however when I try to test if the updates are ok, the mocha raises an exception, that I send below:
> #rmmariano/ol-sb#1.0.0-rc.1 test /home/inpe/Documents/datainfo/npm_packages/ol-sb
> mocha --require #babel/register
/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/ol/control.js:5
export {default as Attribution} from './control/Attribution.js';
^^^^^^
SyntaxError: Unexpected token export
at new Script (vm.js:85:7)
at createScript (vm.js:266:10)
at Object.runInThisContext (vm.js:314:10)
at Module._compile (internal/modules/cjs/loader.js:698:28)
at Module._compile (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Object.newLoader [as .js] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/inpe/Documents/datainfo/npm_packages/ol-sb/src/ol3-sidebar.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Module._compile (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Object.newLoader [as .js] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/inpe/Documents/datainfo/npm_packages/ol-sb/src/index.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Module._compile (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Object.newLoader [as .js] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/inpe/Documents/datainfo/npm_packages/ol-sb/test/test.js:4:1)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Module._compile (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Object.newLoader [as .js] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at /home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:327:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:324:14)
at Mocha.run (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:801:10)
at Object.exports.singleRun (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run-helpers.js:207:16)
at exports.runMocha (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run-helpers.js:300:13)
at Object.exports.handler.argv [as handler] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run.js:296:3)
at Object.runCommand (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/lib/command.js:238:44)
at Object.parseArgs [as _parseArgs] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:1089:24)
at Object.parse (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:566:25)
at Object.exports.main (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/cli.js:62:6)
at Object.<anonymous> (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/bin/_mocha:10:23)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
at internal/main/run_main_module.js:21:11
npm ERR! Test failed. See above for more details.
I've already tried to follow the answer of other questions on StackOverflow, such as:
Babel unexpected token import when running mocha tests
Unexpected token import, can not set up ES6 in my JS project with Mocha, Chai and Sinon
But no one of them worked to me, unfortunately.
When I try to update my .babelrc to:
{
"presets": ["#babel/preset-env", "es2015"]
}
The error changes to:
> #rmmariano/ol-sb#1.0.0-rc.1 test /home/inpe/Documents/datainfo/npm_packages/ol-sb
> mocha --require #babel/register
/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:1148
else throw err
^
Error: Cannot find module 'babel-preset-es2015' from '/home/inpe/Documents/datainfo/npm_packages/ol-sb'
at Function.module.exports [as sync] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/resolve/lib/sync.js:58:15)
at resolveStandardizedName (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/files/plugins.js:101:31)
at resolvePreset (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/files/plugins.js:58:10)
at loadPreset (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/files/plugins.js:77:20)
at createDescriptor (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:154:9)
at items.map (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:101:10)
at presets (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:47:19)
at mergeChainOpts (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-chain.js:320:26)
at /home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-chain.js:283:7
at buildRootChain (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-chain.js:120:22)
at loadPrivatePartialConfig (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/partial.js:85:55)
at loadFullConfig (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/full.js:43:39)
at loadOptions (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/index.js:27:36)
at OptionManager.init (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/index.js:231:36)
at compile (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/register/lib/node.js:61:42)
at compileHook (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/register/lib/node.js:102:12)
at Module._compile (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:93:29)
at Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Object.newLoader [as .js] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at /home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:327:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:324:14)
at Mocha.run (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:801:10)
at Object.exports.singleRun (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run-helpers.js:207:16)
at exports.runMocha (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run-helpers.js:300:13)
at Object.exports.handler.argv [as handler] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run.js:296:3)
at Object.runCommand (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/lib/command.js:238:44)
at Object.parseArgs [as _parseArgs] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:1089:24)
at Object.parse (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:566:25)
at Object.exports.main (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/cli.js:62:6)
at Object.<anonymous> (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/bin/_mocha:10:23)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
at internal/main/run_main_module.js:21:11
npm ERR! Test failed. See above for more details.
package.json
{
...
"scripts": {
"start": "nodemon --exec babel-node ./src/index.js",
"test": "./node_modules/.bin/mocha --require #babel/register"
},
"devDependencies": {
"#babel/cli": "^7.2.3",
"#babel/core": "^7.3.4",
"#babel/node": "^7.2.2",
"#babel/preset-env": "^7.3.4",
"#babel/register": "^7.0.0",
"chai": "^4.2.0",
"mocha": "^6.0.2",
"nodemon": "^1.18.10"
},
"dependencies": {
"ol": "^5.3.1"
}
}
.babelrc
{
"presets": ["#babel/preset-env"]
}
Could someone help me?
Source code can be found here: https://github.com/rmmariano/ol-sb
Edit 1:
I've tried to update my .babelrc to:
{
"presets": ["#babel/preset-env", "es2015"]
}
And to install the package:
npm install -S babel-preset-es2015
But the following error starts to appear when I run "npm test":
> #rmmariano/ol-sb#1.0.0-rc.1 test /home/inpe/Documents/datainfo/npm_packages/ol-sb
> mocha --require #babel/register
/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:1148
else throw err
^
Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/babel-preset-es2015/lib/index.js
at createDescriptor (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:178:11)
at items.map (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:101:10)
at presets (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-descriptors.js:47:19)
at mergeChainOpts (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-chain.js:320:26)
at /home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-chain.js:283:7
at buildRootChain (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/config-chain.js:120:22)
at loadPrivatePartialConfig (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/partial.js:85:55)
at loadFullConfig (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/full.js:43:39)
at loadOptions (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/config/index.js:27:36)
at OptionManager.init (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/core/lib/index.js:231:36)
at compile (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/register/lib/node.js:61:42)
at compileHook (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/#babel/register/lib/node.js:102:12)
at Module._compile (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:93:29)
at Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Object.newLoader [as .js] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at /home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:327:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:324:14)
at Mocha.run (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/mocha.js:801:10)
at Object.exports.singleRun (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run-helpers.js:207:16)
at exports.runMocha (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run-helpers.js:300:13)
at Object.exports.handler.argv [as handler] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/run.js:296:3)
at Object.runCommand (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/lib/command.js:238:44)
at Object.parseArgs [as _parseArgs] (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:1089:24)
at Object.parse (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:566:25)
at Object.exports.main (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/lib/cli/cli.js:62:6)
at Object.<anonymous> (/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/mocha/bin/_mocha:10:23)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
at internal/main/run_main_module.js:21:11
npm ERR! Test failed. See above for more details.
Edit 2:
I've tried to update my .babelrc to:
{
"presets": ["#babel/preset-env", "#babel/preset-es2015"]
}
And to install the package:
npm install -S #babel/preset-es2015
But the following error starts to appear when I run "npm test":
> #rmmariano/ol-sb#1.0.0-rc.1 test /home/inpe/Documents/datainfo/npm_packages/ol-sb
> mocha --require #babel/register
/home/inpe/Documents/datainfo/npm_packages/ol-sb/node_modules/yargs/yargs.js:1148
else throw err
^
Error: Cannot find module '#babel/preset-es2015' from '/home/inpe/Documents/datainfo/npm_packages/ol-sb'
Short solution. I had a similar problem with imports and exports.
Also, Babel did not work well with mocha version 7.2.0 and npm version 6.14.4. So I solved the problem using esm version 3.2.25.
npm install --save-dev esm
My package.json is using this:
"scripts": {
"test": "mocha -r esm --exit"
}
I was searching through the whole internet to find a solution. I came up with this:
npx mocha --require ts-node/register --require esm src/**/*.spec.ts
Or in package.json scripts (both options work, choose whichever you like):
"scripts": {
"test": "mocha -r esm -r ts-node/register src/**/*.spec.ts",
"test-ts": "ts-mocha -r esm -p tsconfig.json src/**/*.spec.ts"
}
And don't forget to add esm to devDependencies:
npm install --save-dev esm
so in package.json it is gonna be
"devDependencies": {
"esm": "^3.2.25"
}
I get your code on github, and I see your problem.
This problem is in your ol3-sidebar.js, in this file on first line you import a function from file ol/control.js, but this file is not present in your workspace. So it is giving error when running the tests.
I had the same problem. And managed to solve it after re-installing windows and it still not working.
For me it was that the project folder was on a different drive accessed via a symbolic link. I have a small SSD for boot so keep project folders on a second larger disk drive, and symlink from my home directory to this folder.
If i navigate directly to the folder it works.
I'll report this to both Mocha and Babel teams. I'm not sure who's problem this is.
I think your problem(s) come from Babel. Try first:
npx babel-upgrade
to see the modifications that the package babel-upgrade will do without applying them, and if your are satisfied:
npx babel-upgrade --write
to apply the modifications.
I had a similar problem and had to run
npm install --save-dev core-js#3
My .bablerc was:
{
"presets": [["#babel/preset-env"]]
}

i have an error at nodejs with 'oracledb'

I have an error with oracledb modules.
I have successed to install oracledb.
when i typed like this,
-> npm install oracledb
njsOracle.cpp
njsPool.cpp
njsConnection.cpp
njsResultSet.cpp
njsMessages.cpp
njsIntLob.cpp
dpiEnv.cpp
dpiEnvImpl.cpp
dpiException.cpp
dpiExceptionImpl.cpp
dpiConnImpl.cpp
dpiDateTimeArrayImpl.cpp
dpiPoolImpl.cpp
dpiStmtImpl.cpp
dpiUtils.cpp
dpiLob.cpp
dpiCommon.cpp
win_delay_load_hook.cc
C:\Users\aaa\AppData\Roaming\npm\node_modules\oracledb\build\Release\oracledb.lib 라이브러리 및 C:\Users\aaa
\AppData\Roaming\npm\node_modules\oracledb\build\Release\oracledb.exp 개체를 생성하고 있습니다.
코드를 생성하고 있습니다.
코드를 생성했습니다.
oracledb.vcxproj -> C:\Users\aaa\AppData\Roaming\npm\node_modules\oracledb\build\Release\oracledb.node
oracledb.vcxproj -> C:\Users\aaa\AppData\Roaming\npm\node_modules\oracledb\build\Release\oracledb.pdb (Full PDB)
C:\Users\GwiTtaeGi\AppData\Roaming\npm
`-- oracledb#1.13.1
but when i execute require('oracledb'), there's an error like this.
Error: The specified procedure could not be found.
\?\c:\testnode\test\node_modules\oracledb\build\Release\oracledb.node
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
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 Object. (c:\testnode\test\node_modules\oracledb\lib\oracledb.js:35:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
I can't fix this error..
version is..
node -v : v6.10.3
npm -v : 4.5.0
Firstly, try to clean NPM cache
rm -rf ~/.node-gyp ~/.npm; npm cache clean
If error still occurs, try set NODE_PATH environment variable

Categories