Open lwojgithub opened 3 years ago
https://github.com/OWASP/samm/blob/master/Supporting%20Resources/app/server/router/index.router.js#L3 seems to be this import. I don't see it in the package.json
, not sure if it's been globally installed on the dev system.
Seems to match https://www.npmjs.com/package/q based on usage.
I'd suggest maybe an npm install --save q
from within the server
directory might fix this issue.
Going forward, probably a PR with an updated package.json
to commit the fix.
Hi,
I'd suggest maybe an npm install --save q from within the server directory might fix this issue <- not working I also try npm install within /server catalog <- not working
Maybe instruction is not precisious?
my steps:
I'm not sure the project's history or where it lived before here. When I tried installing q
, it changed to failing on the async
package. So I ran an npm install --save async
as well. That got me past the dependency errors. I didn't set up the DB, so that failed, but...
Can you confirm?
I ran it with an npm start
after.
No, I got:
server@1.0.0 start /opt/samm/Supporting Resources/app/server node server.js
internal/modules/cjs/loader.js:323 throw err; ^
Error: Cannot find module '/opt/samm/Supporting Resources/app/server/node_modules/Q/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:315:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:528:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:818:27)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.node server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server@1.0.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! /home/samm/.npm/_logs/2021-02-17T22_13_54_366Z-debug.log
what NodeJS / npm version are you using?
I have node v14.15.4 and npm v7.5.3 .. but there were some package warnings as well, node v12.x would probably be a better choice in the near term if it can be made to work.
I also cloned it from this repo, and from your directory structure it looks like you cloned from https://github.com/OWASP/samm.git
So I did a fresh clone of that repo. Then did the following:
npm install
npm start
-- failed on module Q
npm install --save q
npm start
-- failed on module async
npm install --save async
npm start
-- worked up to DB error.
Then I reset by restoring the package.json and package-lock.json and rm -rf the node_modules, and repeated the steps on node 12, and that worked the same for me.
did you run these commands in the / server directory ?
Yeah, that's correct. I ran them in /server
.
Hi, have the same problem with module Q, tried:
So I did a fresh clone of that repo. Then did the following in /dashboard-webapp/server:
npm install
npm start -- failed on module Q
npm install --save q
npm start
but there is still "Error: Cannot find module 'Q'". Any thoughts on what else to try? thx
cd node_modules
ln -s q Q
cd ../models
ln -s User.js user.js
From: Unknownl3 @.> Sent: Tuesday, July 6, 2021 4:58 PM To: owaspsamm/dashboard-webapp @.> Cc: Łukasz Wojnowski @.>; Author @.> Subject: Re: [owaspsamm/dashboard-webapp] Error: Cannot find module 'Q' (#1)
Hi, have the same problem with module Q, tried:
So I did a fresh clone of that repo. Then did the following in /dashboard-webapp/server: npm install npm start -- failed on module Q npm install --save q npm start
but there is still "Error: Cannot find module 'Q'". Any thoughts on what else to try? thx
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/owaspsamm/dashboard-webapp/issues/1#issuecomment-874835158 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLDQ6CS4CEJCTZGFI6UKCDTWMKYRANCNFSM4XYL4I6Q . https://github.com/notifications/beacon/ACLDQ6B7XFVI5YGHJBRHNWDTWMKYRA5CNFSM4XYL4I62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGQSOZVQ.gif
I'm not sure the project's history or where it lived before here. When I tried installing
q
, it changed to failing on theasync
package. So I ran annpm install --save async
as well. That got me past the dependency errors. I didn't set up the DB, so that failed, but... Can you confirm? I ran it with annpm start
after.
I'm getting exactly same error. do we have any solution for this? @mgillam @lwojgithub @dkefer
To be clear, I'm not a maintainer of this project. I have verified that it's behaving the same way for me today as it was on Feb 17. Which is to be expected, since I hadn't set up the Db, and still haven't. The I believe the Error connecting to Db
message is correct behavior for my context.
@mgillam thx for quick reply , did u fixed the issue as you mentioned because currently I'm getting exactly same issue.
@mgillam thx for quick reply , did u fixed the issue as you mentioned because currently I'm getting exactly same issue.
Hi @satyendra22 comments: https://github.com/owaspsamm/dashboard-webapp/issues/1#issuecomment-780900118 and https://github.com/owaspsamm/dashboard-webapp/issues/1#issuecomment-875340098
helped me to fix that issue.
P.S. conection to Db looks fine too.
saw a few issues on npm imports/requires for the server package Q was one of them, async missing was another one. I would expect that you would want to correct case on the requires vs having to give a symlink from Q -> q. Other module import case sensitivity seen on requiring ../models/users when the file name is in caps so should be ../models/Users(?) or renaming the file to lowercase...
executed command in /server folder npm install npm install nodemon npm start
internal/modules/cjs/loader.js:638 throw err; ^
Error: Cannot find module 'Q' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/opt/samm/server/router/index.router.js:3:9)
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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server@1.0.0 start:
node server.js
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the server@1.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.cd /server/node_modules/Q cat README.md
Deprecated Package
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.
Please contact support@npmjs.com if you have questions about this package.