Gulp exited witch code 1 in VS2017 - Build failed - node.js

I have an error when I try to build mvc solution.
The command "gulp" exited with code 1
When I go to output window I can see this
1> ReferenceError: primordials is not defined
1> at fs.js:47:5
1> at req_ (C:\Work\tiptimes\MvcApplication\node_modules\natives\index.js:143:24)
1> at Object.req [as require] (C:\Work\tiptimes\MvcApplication\node_modules\natives\index.js:55:10)
1> at Object.<anonymous> (C:\Work\tiptimes\MvcApplication\node_modules\graceful-fs\fs.js:1:37)
1> at Module._compile (node:internal/modules/cjs/loader:1095:14)
1> at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
1> at Module.load (node:internal/modules/cjs/loader:975:32)
1> at Function.Module._load (node:internal/modules/cjs/loader:816:12)
1> at Module.require (node:internal/modules/cjs/loader:999:19)
1> at require (node:internal/modules/cjs/helpers:93:18)
I setup global variable to the NODE_PATH to reference npm/modules.
Here is my list of dependencies:
"engines": {
"node": "5.9.1",
"npm": "3.7.3"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0",
"gulp-minify-css": "^1.2.4",
"gulp-sourcemaps": "^2.3.0",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"merge-stream": "^1.0.0"
}
}

Related

Electron-updater cannot find module 'fs/promises'

I have a problem that electron-updater cannot find module 'fs/promises'. All another solutions don`t help me. Here is my log.
Error: Cannot find module 'fs/promises'
Require stack:
- E:\VSProjects\Launcher_JS\node_modules\electron-updater\out\AppUpdater.js
- E:\VSProjects\Launcher_JS\node_modules\electron-updater\out\main.js
- E:\VSProjects\Launcher_JS\src\index.js
- E:\VSProjects\Launcher_JS\node_modules\electron-prebuilt-compile\lib\es6-init.js
- E:\VSProjects\Launcher_JS\node_modules\electron-prebuilt-compile\node_modules\electron\dist\resources\default_app.asar\main.js
-
at Module._resolveFilename (internal/modules/cjs/loader.js:798:15)
at Function../lib/common/reset-search-paths.ts.Module._resolveFilename (electron/js2c/browser_init.js:7607:16)
at Module._load (internal/modules/cjs/loader.js:691:27)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (E:\VSProjects\Launcher_JS\node_modules\electron-updater\out\AppUpdater.js:8:20)
at Module._compile (internal/modules/cjs/loader.js:968:30)
at Object.require.extensions.<computed> [as .js] (E:\VSProjects\Launcher_JS\node_modules\electron-compile\lib\require-hook.js:77:14)
package.json contains
"dependencies": {
"#electron/remote": "^2.0.8",
"electron-compile": "^6.4.4",
"electron-squirrel-startup": "^1.0.0",
"electron-updater": "^4.6.5",
"fs-extra": "^10.0.1",
"react": "^17.0.2",
"sound-play": "^1.1.0",
"update-electron-app": "^2.0.1"
},
"devDependencies": {
"#types/node": "^17.0.21",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"electron": "^17.1.2",
"electron-builder": "^22.14.13",
"electron-forge": "^5.2.4",
"electron-prebuilt-compile": "8.2.0",
"electron-winstaller": "^5.0.0",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.29.3",
"jquery": "^3.6.0"
}
Reinstallation of node_modules did not help me. Node.js have version 16.14.0
Delete yarn.lock and node_modules and run
yarn install
again

Node Sass Error: Cannot find module 'mkdirp'

I have the following package.json
"devDependencies": {
"bootstrap-sass": "*",
"buble": "^0.12.5",
"css-loader": "^0.25.0",
"gulp": "*",
"jquery": "^3.1.0",
"json-loader": "^0.5.4",
"laravel-elixir": "^6.0.0-14",
"laravel-elixir-browsersync-official": "^1.0.0",
"laravel-elixir-vue-2": "^0.2.0",
"laravel-elixir-webpack-official": "^1.0.2",
"lodash": "^4.16.2",
"sass": "*",
"sass-loader": "*",
"vue": "^2.1.10",
"vue-loader": "^9.7.0",
"vue-resource": "^1.0.3",
"vue-router": "^2.0.0",
"vue-stash": "^2.0.1-beta",
"vue-template-compiler": "^2.1.10"
},
"dependencies": {
"bootstrap-datepicker": "^1.6.4",
"jquery-simple-upload": "^1.0.0",
"json-loader": "^0.5.4",
"moment": "*",
"natives": "^1.1.6",
"vuejs-datepicker": "^0.9.24"
}
On using Yarn to install the modules I am met with
warning "laravel-elixir-vue-2 > sass-loader#4.1.1" has unmet peer
dependency "webpack#^2 || ^2.2.0-rc.0 || ^2.1.0-beta || ^1.12.6".
[4/4] Building fresh packages... error
/home/vagrant/Code/xxx/node_modules/node-sass:
Command failed. Exit code: 1 Command: node scripts/install.js
Arguments: Directory:
/home/vagrant/Code/xxx/node_modules/node-sass
Output: internal/modules/cjs/loader.js:818 throw err; ^
Error: Cannot find module 'mkdirp' Require stack:
/home/vagrant/modules/xxx/node-sass/scripts/install.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/home/vagrant/modules/xxx/node-sass/scripts/install.js:7:11)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) { code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/vagrant/modules/xxx/node-sass/scripts/install.js' ]
I'm not sure why/ who is installing node-sass but it brings me to this point regardless if I yarn clean cache rm -rf package.lock.json or rm -rf node_modules
I'm using
yarn 1.22.10
node 12.20.0
npm 6.14.9
on Linux homestead 4.15.0-124-generic #127-Ubuntu
Looks like node LTS is 14.something.
Maybe try updating that (and everything else)?
Not sure where install "mkdirp".
but you can install mkdirp#lastest first,
then let yarn/npm install all package again
to see whether "mkdirp" is a really problem or not.
yarn add mkdirp#lastest // or npm i mkdirp#lastest
then
yarn install // or npm i

Node cannot find module ~/package.json (closed)

I'm trying to start my API with node but this error appears :
$ node ./.local/start.js
module.js:549
throw err;
^
Error: Cannot find module '/c/Users/$AAU000-TFETR2QTBK6P/Desktop/Stage/whasq-api-master/package.json'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at ConfigurationManager.getPackageConfig (C:\Users\$AAU000-TFETR2QTBK6P\Desktop\Stage\whasq-api-master\node_modules\#rduk\configuration\lib\manager.js:61:15)
at getDocument (C:\Users\$AAU000-TFETR2QTBK6P\Desktop\Stage\whasq-api-master\node_modules\#rduk\configuration\lib\manager.js:74:31)
at ConfigurationManager.getSection (C:\Users\$AAU000-TFETR2QTBK6P\Desktop\Stage\whasq-api-master\node_modules\#rduk\configuration\lib\manager.js:106:19)
at ConfigurationManager.get (C:\Users\$AAU000-TFETR2QTBK6P\Desktop\Stage\whasq-api-master\node_modules\#rduk\configuration\lib\manager.js:93:25)
at Object.<anonymous> (C:\Users\$AAU000-TFETR2QTBK6P\Desktop\Stage\whasq-api-master\index.js:14:38)
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)
The real problem is that the file package.json is present..
ls -a (at ~/Desktop/Stage/whasq-api-master)
./ ../ .circleci/ .gitignore .local/ api/ config/ ecosystem.config.js index.js lib/ node_modules/ package.json package-lock.json README.md sf_certificate/ templatesES.md
//package.json content
{
"name": "whasq-api",
"version": "0.1.1",
"description": "whasq-api",
"engines": {
"node": ">=8.11.1"
},
"main": "index.js",
"scripts": {
"pretest": "standard --fix",
"test": "exit 0"
},
"author": "WhASQ",
"license": "ISC",
"dependencies": {
"#rduk/configuration": "^2.2.3",
"#rduk/errors": "^1.3.1",
"#rduk/logger": "^1.0.3",
"#rduk/logger-winston-loggly-factory": "0.1.0",
"#rduk/logger-winston-provider": "^1.0.4",
"#rduk/message-broker": "^2.4.0",
"#rduk/provider": "^3.1.3",
"#rduk/tasks-orchestrator": "^0.1.3",
"aws-sdk": "^2.256.1",
"axios": "^0.18.1",
"bcrypt": "^3.0.4",
"body-parser": "^1.18.2",
"csv": "^3.1.0",
"dotenv": "5.0.1",
"elasticsearch": "^16.4.0",
"express": "4.16.3",
"express-request-id": "^1.4.1",
"helmet": "^3.15.1",
"jsonwebtoken": "8.2.1",
"morgan": "^1.9.1",
"multer": "^1.3.1",
"orm": "^5.0.4",
"package.json": "^2.0.1",
"pg": "^7.4.1",
"react-s3-uploader": "^4.8.0",
"socket.io": "2.0.4",
"socketio-jwt": "4.5.0",
"standard": "11.0.1",
"swagger-express-mw": "0.7.0",
"winston": "2.4.0"
},
"directories": {
"lib": "lib"
},
"devDependencies": {},
"keywords": []
}
I tried a lot of things, like switch versions of Node, delete modules then reinstall them, and other stuff like that but I cannot solve this problem.
I'm using those versions :
npm 6.11.3 node 8.11.1 and I'm using GitBash (i tried Powershell but no change)
(I tried every single version of Node (>=8.11.1) and the error is the same every time)
ls -a (at ~/Desktop/Stage/whasq-api-master/.local)
.env start.js
//start.js content
require('dotenv').load({path: process.env.PWD + '/.local/.env'})
require('../')
//.env content
RDUK_CONFIG_PATH=config
RDUK_CONFIG_PREFIX=app
RDUK_CONFIG_EXT=.yaml
APP_PORT=6500
APP_SECRET=xxx
SF_SECRET=(hidden)
SF_CERTIFICATE=sf_certificate/public.pem
AMQP_ADDRESS=amqp://cawdev:cawdev#192.168.1.87:5672
LOGGLY_TOKEN=xxx
LOGGLY_SUBDOMAIN=xxx
LOGGLY_LOGIN=jessie
LOGGLY_PASSWORD=(hidden)
ES_ADDRESS=http://cawtest.net:9200/
DB_PROTOCOL=postgresql
DB_HOST=localhost
DB_PORT=5433
DB_NAME=mydb
DB_USER=esteban
DB_PASS=(hidden)
AWS_ACCESS_KEY_ID=(hidden)
AWS_SECRET_ACCESS_KEY=(hidden)
AWS_REGION=eu-west-3
AWS_BUCKET=(hidden)
I also tried to move my repository at C:/ to avoid potential problems with my username ($AAU000-TFETR2QTBK6P) because I thought that name could be mistaken for an environment variable.
The issue come from the way Windows interpret the npm library, I advise you to switch to a Linux or Mac environment..

Error: Cannot find module './Mime'

I am trying to get a heroku project running (following the tutorial here) and I'm running into a bit of trouble.
The node task on Heroku is throwing the following:
app[web.1]: module.js:540
app[web.1]: throw err;
app[web.1]: ^
app[web.1]:
app[web.1]: Error: Cannot find module './Mime'
app[web.1]: at Function.Module._resolveFilename (module.js:538:15)
app[web.1]: at Function.Module._load (module.js:468:25)
app[web.1]: at Module.require (module.js:587:17)
app[web.1]: at Object.<anonymous> (/app/node_modules/mime/index.js:3:12)
app[web.1]: at require (internal/module.js:11:18)
app[web.1]: at Module._compile (module.js:643:30)
app[web.1]: at Object.Module._extensions..js (module.js:654:10)
app[web.1]: at Module.load (module.js:556:32)
app[web.1]: at tryModuleLoad (module.js:499:12)
app[web.1]: at Function.Module._load (module.js:491:3)
I have installed (with -save) all of the dependencies I need including mime, but it seems like it's getting caught up with the mime module itself, here's the mime node_module:
1,545 .eslintrc.json
<DIR> .github
9,230 CHANGELOG.md
157 cli.js
127 index.js
1,098 LICENSE
101 lite.js
1,951 Mime.js
2,824 package.json
5,468 README.md
<DIR> src
<DIR> types
The mime/index.js file:
'use strict';
var Mime = require('./Mime');
module.exports = new Mime(require('./types/standard'), require('./types/other'));
and my project's dependencies
"dependencies": {
"body-parser": "^1.15.2",
"cheerio": "^1.0.0-rc.2",
"cookie-parser": "^1.4.3",
"express": "^4.14.0",
"express-handlebars": "^3.0.0",
"express-less": "^0.1.0",
"express-minify": "^0.2.0",
"favicon": "0.0.2",
"helmet": "^2.3.0",
"http": "0.0.0",
"logger": "0.0.1",
"mime": "^2.0.3",
"mongodb": "^2.2.11",
"morgan": "^1.7.0",
"nodemailer": "^4.4.1",
"nodemailer-sendgrid-transport": "^0.2.0",
"path": "^0.12.7",
"serve-favicon": "^2.3.0"
}
Thanks for your help!
Whelp, hard to say 100% what I did to fix the issue but it was probably one of the following things.
I added "engines": {"node": "7.5.0","npm": "4.1.2"} to my node package (see here)
I added a Procfile to the root with web: node server.js (see here)
as a side note, caching was a big issue for me after I solved this issue. This link may help with that.

grunt --tasks error path.js:488 throw new TypeError('Arguments to path.join must be strings')

my node is v0.12.7, and my grunt is grunt-cli v0.1.13 grunt v0.4.5.
the following is my dependencies in package.json.
"bower": "1.3.8",
"grunt": "0.4.5",
"grunt-bower": "0.18.0",
"grunt-cachebuster": "0.1.5",
"grunt-check-dependencies": "0.3.1",
"grunt-cli": "0.1.13",
"grunt-connect-proxy": "0.2.0",
"grunt-contrib-clean": "0.5.0",
"grunt-contrib-compress": "0.10.0",
"grunt-contrib-connect": "0.5.0",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-cssmin": "0.9.0",
"grunt-contrib-jshint": "0.11.0",
"grunt-contrib-requirejs": "0.4.4",
"grunt-contrib-watch": "0.5.3",
"grunt-git-describe": "2.3.2",
"grunt-karma": "0.10.1",
"grunt-replace": "0.8.0",
"grunt-requirejs": "0.4.2",
"grunt-shell": "0.6.4",
"grunt-version-copy-bower-components": "^0.1.11",
"jasmine-core": "2.2.0",
"karma": "0.12.31",
"karma-chrome-launcher": "0.1.7",
"karma-jasmine": "0.3.5",
"karma-phantomjs-launcher": "0.1.4",
"karma-requirejs": "0.2.2",
"karma-spec-reporter": "0.0.12",
"load-grunt-config": "0.13.2",
"path": "^0.11.14",
"requirejs": "2.1.16",
"shelljs": "0.3.0"
and the following is my gruntfile.js
require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'tasks')
})
I search many materials which told me someone have fixed it. Could anyone help me to look into it?
My error stacks is
TypeError: Arguments to path.join must be strings
at Object.posix.join (path.js:488:13)
at Object.file.exists (/Users/zwshao/REA/widgets_new/node_modules/grunt/lib/grunt/file.js:381:28)
at task.loadTasks (/Users/zwshao/REA/widgets_new/node_modules/grunt/lib/grunt/task.js:371:18)
at Array.forEach (native)
at Task.task.init (/Users/zwshao/REA/widgets_new/node_modules/grunt/lib/grunt/task.js:457:33)
at Object.grunt.tasks (/Users/zwshao/REA/widgets_new/node_modules/grunt/lib/grunt.js:120:8)
at Object.module.exports [as cli] (/Users/zwshao/REA/widgets_new/node_modules/grunt/lib/grunt/cli.js:38:9)
at Object.<anonymous> (/usr/local/lib/node_modules/grunt-cli/bin/grunt:45:20)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

Resources