saleor salor-dashboard npm start gives errors - node.js

I am trying to install the saleor-dashboard latest version(3.7.0), but getting strange errors.
I have done npm start, npm audit fix --force npm install but got the same error and read from a Github page https://github.com/rails/rails/issues/43062#issuecomment-904965034 and a stackoverflow page that the current webpack dev server version is not compatible so I should downgrade it to version 3. I did that as well, but I am still facing the same issue.
The error is:
/root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/utils/prompt-command.js:46
return func(...args);
^
TypeError: Class constructor ServeCommand cannot be invoked without 'new'
at runWhenInstalled (/root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/utils/prompt-command.js:46:9)
at promptForInstallation (/root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/utils/prompt-command.js:140:10)
at /root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/cli.js:32:43
at Object.<anonymous> (/root/codes/backend/test/saleor-dashboard/node_modules/webpack-cli/bin/cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! saleor-dashboard#3.7.0 start: `npm run build-types && webpack-dev-server -d`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the saleor-dashboard#3.7.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-09-03T06_21_34_373Z-debug.log
My package.json includes:
"devDependencies": {
"ts-jest": "^27.0.7",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "^4.3.5",
"webpack": "^5.74.0",
"webpack-bundle-analyzer": "^4.4.1",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "3.11.2",
}
Would appreciate a lot if somebody can help me with this.

Related

AWS - EB - Node - Error: Cannot find module '../'

Bcrypt with its dependency node-pre-gyp causes some serious issue when deployed to Elastic Beanstalk.
bcrypt version: 3.0.6
Nodejs version: 8.16 (also same for v.10)
Amazon Linux 4.8.2
bcrypt#3.0.6 install /tmp/deployment/application/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
module.js:550
throw err;
^
Error: Cannot find module '../'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/tmp/deployment/application/node_modules/.bin/node-pre-gyp:15:20)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/.npm/_logs/2019-08-11T14_06_34_179Z-debug.log
Running npm install: /opt/elasticbeanstalk/node-install/node-v8.15.1-linux-x64/bin/npm
Setting npm config jobs to 1
npm config jobs set to 1
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
UTC 2019/08/11 14:06:34 cannot find application npm debug log at /tmp/deployment/application/npm-debug.log
And relevant sections of package.json
"dependencies": {
"axios": "^0.19.0",
"bcrypt": "^3.0.6",
"body-parser": "^1.18.3",
"chai": "^4.2.0",
"express": "^4.16.4",
"firebase": "^5.8.6",
"firebase-admin": "~6.0.0",
"jsonwebtoken": "^8.5.0",
"mocha": "^6.0.2",
"shortid": "^2.2.14"
},
"devDependencies": {
"#babel/cli": "^7.2.3",
"#babel/core": "^7.3.4",
"#babel/polyfill": "^7.2.5",
"#babel/preset-env": "^7.3.4",
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0"
},
"private": true
}
When deploying to Elastic Beanstalk running Node 8.x, node-gyp doesn't have sufficient permissions to write to the tmp directory. bcrypt won't install and the application deployment will fail.
A workaround is to add a .npmrc file to the root of your project that will force node-gyp to run as root and allow the installation to complete. File contents for .npmrc:
# Force npm to run node-gyp also as root, preventing permission denied errors in AWS with npm#5 or #6
unsafe-perm=true
pls check this also https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions
Credit goes to this post:
Beanstalk: Node.js deployment - node-gyp fails due to permission denied

Endless Loop: Cannot find 'cross-spawn'

Problem
I am stuck in a loop where running npm run watch says it cannot find cross-spawn.
> # watch /Users/donnie/Github/laravel_project
> npm run development -- --watch
> # development /Users/donnie/Github/laravel_project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
module.js:549
throw err;
^
Error: Cannot find module 'cross-spawn'
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 Object.<anonymous> (/Users/donnie/.yarn-cache/npm-cross-env-5.2.0/dist/index.js:5:19)
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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/donnie/.npm/_logs/2019-01-22T21_57_39_199Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/donnie/.npm/_logs/2019-01-22T21_57_39_227Z-debug.log
I run npm i --D cross-spawn which is successful, then npm run watch again. It says there are a few more dependencies that must be installed (which is strange because the first thing I did was npm install.) Anyway, it finally provides this feedback:
Okay, done. The following packages have been installed and saved to your package.json dependencies list:
- vue-template-compiler
- sass-loader#7.*
- sass
- resolve-url-loader#2.3.1
Finished. Please run Mix again.
Cool. So I run npm run watch again and we're right back to the cross-spawn problem.
I've tried deleting /node_modules and starting fresh. No luck.
🤔
package.json
{
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"cross-spawn": "^6.0.5"
"false": "^0.0.4",
"jquery": "^3.2",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"resolve-url-loader": "2.3.1",
"sass": "^1.16.1",
"sass-loader": "7.*",
"vue": "^2.5.17",
"vue-template-compiler": "^2.5.22"
},
"dependencies": {}
}
Environment
npm: 6.3.0
laravel: 5.7
Running npm rebuild then npm install should fix the problem. Now, running npm run dev should build fine.
I believe this issue has something to do with bad file permissions and npm rebuild seems to sort things out.
Ran into a similar issue with craco.
The following fixed it for me:
rm -rf node_modules
rm package-lock.json
npm install
Edit: I should mention that this is less than optimal. Removing your lock file is generally a bad idea and can result in dependency conflicts. In my specific case, it didn't matter, but it may matter in yours. Take precautions if you plan on applying this "fix" (create a backup if you don't use git).

TypeError: Cannot read property 'length' of undefined in tsc.js

I have created a nodejs api project using typescript. But I am not able to start it. This is the command I am running
npm start
This is the output of this command
> project1#1.0.0 prestart D:\Workspace
> tsc
D:\Workspace\node_modules\typescript\lib\tsc.js:9921
for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) {
^
TypeError: Cannot read property 'length' of undefined
at Object.forEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:9921:70)
at setParentPointers (D:\Workspace\node_modules\typescript\lib\tsc.js:17392:12)
at D:\Workspace\node_modules\typescript\lib\tsc.js:17392:64
at visitNode (D:\Workspace\node_modules\typescript\lib\tsc.js:9533:24)
at Object.forEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:9918:25)
at setParentPointers (D:\Workspace\node_modules\typescript\lib\tsc.js:17392:12)
at D:\Workspace\node_modules\typescript\lib\tsc.js:17392:64
at visitNodes (D:\Workspace\node_modules\typescript\lib\tsc.js:9542:30)
at Object.forEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:9891:24)
at setParentPointers (D:\Workspace\node_modules\typescript\lib\tsc.js:17392:12)
at bindChildrenWorker (D:\Workspace\node_modules\typescript\lib\tsc.js:15178:25)
at bindChildren (D:\Workspace\node_modules\typescript\lib\tsc.js:15129:17)
at bindContainer (D:\Workspace\node_modules\typescript\lib\tsc.js:15122:17)
at bind (D:\Workspace\node_modules\typescript\lib\tsc.js:16214:21)
at Object.forEach (D:\Workspace\node_modules\typescript\lib\tsc.js:275:30)
at bindEach (D:\Workspace\node_modules\typescript\lib\tsc.js:15149:20)
at visitNodes (D:\Workspace\node_modules\typescript\lib\tsc.js:9538:24)
at Object.forEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:9707:24)
at bindEachChild (D:\Workspace\node_modules\typescript\lib\tsc.js:15165:16)
at bindChildrenWorker (D:\Workspace\node_modules\typescript\lib\tsc.js:15254:21)
at bindChildren (D:\Workspace\node_modules\typescript\lib\tsc.js:15129:17)
at bindContainer (D:\Workspace\node_modules\typescript\lib\tsc.js:15093:17)
at bind (D:\Workspace\node_modules\typescript\lib\tsc.js:16214:21)
at bindSourceFile (D:\Workspace\node_modules\typescript\lib\tsc.js:14851:17)
at Object.bindSourceFile (D:\Workspace\node_modules\typescript\lib\tsc.js:14809:9)
at initializeTypeChecker (D:\Workspace\node_modules\typescript\lib\tsc.js:36496:20)
at Object.createTypeChecker (D:\Workspace\node_modules\typescript\lib\tsc.js:18543:9)
at getDiagnosticsProducingTypeChecker (D:\Workspace\node_modules\typescript\lib\tsc.js:56042:93)
at Object.getGlobalDiagnostics (D:\Workspace\node_modules\typescript\lib\tsc.js:56370:53)
at compileProgram (D:\Workspace\node_modules\typescript\lib\tsc.js:59092:78)
at compile (D:\Workspace\node_modules\typescript\lib\tsc.js:59051:26)
at performCompilation (D:\Workspace\node_modules\typescript\lib\tsc.js:58940:33)
at Object.executeCommandLine (D:\Workspace\node_modules\typescript\lib\tsc.js:58883:9)
at Object.<anonymous> (D:\Workspace\node_modules\typescript\lib\tsc.js:59241:4)
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.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\Workspace\node_modules\typescript\bin\tsc:2:1)
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:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! project1#1.0.0 prestart: `tsc`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project1#1.0.0 prestart script 'tsc'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the project1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs project1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls project1
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Workspace\npm-debug.log
and my package.json
{
"name": "project1",
"version": "1.0.0",
"description": "Project 1",
"main": "index.js",
"scripts": {
"prestart": "tsc",
"start": "concurrently \"tsc --watch \" \"nodemon server.js startServer\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
"license": "ISC",
"dependencies": {
"#types/es6-promise": "0.0.32",
"body-parser": "^1.16.0",
"es6-map": "^0.1.5",
"giuseppe": "^1.2.0",
"make-runnable": "^1.0.7",
"request": "^2.79.0",
"request-promise": "^4.1.1",
"typescript": "^2.1.4"
},
"devDependencies": {
"#types/chai": "^3.4.34",
"concurrently": "^3.1.0",
"nodemon": "^1.11.0"
}
}
I have tried deleting node_modules folder and clearing cache using
npm cache clear
and then installing it again using
npm install
but fail to start? what could be the issue?
The issue was with typescript itself. Here is the issue raised on Github
https://github.com/Microsoft/TypeScript/issues/18301
but now the issue has been fixed.
Just update typescript module
npm update typescript --save

Sequelize error on npm start

I'm trying to implement sequelize on my project and when I put
var models = require('../models')
on bin/www, on npm start I get this error:
module.js:471
throw err;
^
Error: Cannot find module 'C:\Users\user\Desktop\projeto\models/..configconfig.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\user\Desktop\projeto\models\index.js:8:17)
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.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\user\Desktop\projeto\bin\www:10:14)
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)
at bootstrap_node.js:504:3
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! projeto#0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the projeto#0.0.0 start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the projeto package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs projeto
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls projeto
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\user\Desktop\projeto\npm-debug.log
Besides the default dependencies on a project created with express, I added these:
"pg": "^7.0.2",
"pg-hstore": "^2.3.2",
"sequelize": "^4.4.2",
"sequelize-cli": "^2.7.0"
Obs:
npm install/update didn't solve the problem
reinstall node.js didn't solve the problem
create a new project didn't solve the problem
does anyone have an idea of how to solve this?
thanks a lot!
#Edit
This is my full package.json
{
"name": "projeto",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"sequelize": "^4.4.2",
"sequelize-cli": "^2.7.0",
"pg": "^7.0.2",
"pg-hstore": "^2.3.2",
"body-parser": "~1.17.1",
"cookie-parser": "~1.4.3",
"debug": "~2.6.3",
"ejs": "~2.5.6",
"express": "~4.15.2",
"morgan": "~1.8.1",
"serve-favicon": "~2.4.2"
}
}
In your models index.js file change the following line:
var config = require(__dirname + '/..\config\config.json')[env];
to:
var config = require(__dirname + '/../config/config.json')[env];

IBM Bluemix ibm_db dashDB module 0.0.15 no longer compiles; module upgrade perhaps?

Has there been a recent "ibm_db" for dashDB module upgrade?
We have been using the Bluemix node.js and ibm_db module to access dashDB. The module has worked ok but now on 10.5.2016 the module no longer compiles on Bluemix. The version we have been using is defined in package.json as ibm_db ^0.0.15. Below is an example of the Bluemix building error log.
----->Building dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> ibm_db#0.0.15 install /tmp/staged/app/node_modules/ibm_db
> node installer/driverInstall.js
module.js:327
throw err;
^
Error: Cannot find module 'fstream'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at download_file_httpget (/tmp/staged/app/node_modules/ibm_db/installer/driverInstall.js:25:19)
at Object.<anonymous> (/tmp/staged/app/node_modules/ibm_db/installer/driverInstall.js:340:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/tmp/staged/app/vendor/node/bin/node" "/tmp/staged/app/vendor/node/bin/npm" "rebuild"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! ibm_db#0.0.15 install: `node installer/driverInstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ibm_db#0.0.15 install script 'node installer/driverInstall.js'.
npm ERR! This is most likely a problem with the ibm_db package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node installer/driverInstall.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ibm_db
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls ibm_db
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/staged/app/npm-debug.log
-----> Build failed
You have to update to ibm_db 0.0.18 to use with Node.js 4.x.
Per your logs you are using Node.js 4.4.3, so your package.json file should be something like:
{
"name": "NodejsStarterApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "4.13.x",
"cfenv": "1.0.x",
"ibm_db": "0.0.18"
},
"repository": {},
"engines": {
"node": "4.x"
}
}

Resources