Module not found: Error: Can't resolve
ctrado18 opened this issue · 11 comments
I get many errors like:
ERROR in ./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\RasaTalk\node_modules\destroy'
@ ./node_modules/destroy/index.js 14:17-30
@ ./node_modules/send/index.js
@ ./node_modules/serve-static/index.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./node_modules/botkit/lib/CoreBot.js
@ ./node_modules/botkit/lib/Botkit.js
@ dll reactBoilerplateDeps
on windows with yarn 1.7
Hi @ctrado18 this looks like an error install node_modules.
Can I suggest you delete the node_modules and both package-lock.json
| yarn.lock
(if they exist) and reinstall with yarn install
or npm install
I followed your suggestion and tried both commands to install. But still same issue!
This is detailed message:
yarn install v1.7.0
info No lockfile found.
$ npm run npmcheckversion
> react-boilerplate@3.6.0 npmcheckversion C:\Users\RasaTalk
> node ./internals/scripts/npmcheckversion.js
(node:7052) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning react-dom@16.4.1: This version of react-dom/server contains a minor vulnerability. Please update react-dom to 16.4.2+. Learn more: https://fb.me/cve-2018-6341
warning css-loader > cssnano > autoprefixer > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning css-loader > cssnano > postcss-merge-rules > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning css-loader > cssnano > postcss-merge-rules > caniuse-api > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning enzyme > rst-selector-parser > nearley > nomnom@1.6.2: Package no longer supported. Contact support@npmjs.com for more info.
warning image-webpack-loader > imagemin-webp > cwebp-bin > bin-build > download > gulp-decompress > gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
warning jest-cli > istanbul-api > istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump
[3/5] Fetching packages...
info fsevents@1.2.4: The platform "win32" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[5/5] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.9.4", while you're on "1.7.0".
info To upgrade, download the latest installer at "https://yarnpkg.com/latest.msi".
$ npm run build:dll
> react-boilerplate@3.6.0 build:dll C:\Users\RasaTalk
> node ./internals/scripts/dependencies.js
Building the Webpack DLL...
Hash: 6233c492a80d6ffd81ac
Version: webpack 4.12.0
Time: 36009ms
Built at: 2018-08-10 20:16:44
Asset Size Chunks Chunk Names
reactBoilerplateDeps.dll.js 23.8 MiB reactBoilerplateDeps [emitted] [big] reactBoilerplateDeps
chunk {reactBoilerplateDeps} reactBoilerplateDeps.dll.js (reactBoilerplateDeps) 19.3 MiB [entry] [rendered]
WARNING in ./node_modules/require_optional/index.js 82:18-42
Critical dependency: the request of a dependency is an expression
@ ./node_modules/mongodb-core/index.js
@ ./node_modules/mongodb/index.js
@ dll reactBoilerplateDeps
WARNING in ./node_modules/require_optional/index.js 90:20-44
Critical dependency: the request of a dependency is an expression
@ ./node_modules/mongodb-core/index.js
@ ./node_modules/mongodb/index.js
@ dll reactBoilerplateDeps
Ah I recognise this. So it's not actually an error and it will run fine. This error occurs due to running both frontend and backend modules from one package.json
Currently on mobile however I'll try and find the link to why in the morning!
In the mean time it should work perfectly fine with the warnings!
Ok, with yarn start I get:
yarn run v1.7.0
$ cross-env NODE_ENV=development node server
Please check environment file.
No port specified
No Rasa ip specified
No JWT Secret specified
No Mongo specified
C:\Users\RasaTalk\node_modules\mongoose\lib\connection.js:424
throw new MongooseError('The `uri` parameter to `openUri()` must be a ' +
^
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
at new MongooseError (C:\Users\RasaTalk\node_modules\mongoose\lib\error\mongooseError.js:11:11)
at NativeConnection.Connection.openUri (C:\Users\RasaTalk\node_modules\mongoose\lib\connection.js:424:11)
at Mongoose.connect (C:\Users\RasaTalk\node_modules\mongoose\lib\index.js:230:15)
at Object.<anonymous> (C:\Users\RasaTalk\server\mongo\schemas\chatbot_db_connect.js:3:10)
at Module._compile (internal/modules/cjs/loader.js:702:30)
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)
at Object.<anonymous> (C:\Users\RasaTalk\server\authentication\models\user.js:1:80)
at Module._compile (internal/modules/cjs/loader.js:702:30)
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)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
But I thinki just have to include the variables now?
Yup exactly, take a look at example.env
, update that and rename it to .env
and you should be good to go!
It works now! But do really have to register a new user? Why is that? And it says:
info: ** No persistent storage method specified! Data may be lost when process shuts down.
registration don't work! It takes long time until it stops sending the registration formular!
Sounds like you've not hooked up a mongoDB instance. Are you running it locally or an online one? The registration can be removed if you want it to.
info: ** No persistent storage method specified! Data may be lost when process shuts down
Is just output from Botkit. We are handling our own data persistence so Botkit it not necessary. A side effect of this is botkit gets worried! When we move away from using Botkit to custom integration this warning will disappear.
Thanks!
Sounds like you've not hooked up a mongoDB instance. Are you running it locally or an online one?
What you mean? I created an account on mlab for Mongo (sandbox) and typed the URi, not more?!
The registration can be removed if you want it to.
How?
Ah I've not tested it with an online MongoDB instance before as this was primarily built to be on premise so I used a local version. However it should not really matter if it's online. I'll give it ago after work.
As for removing registration you can rename PrivateRoute
to Route
here:
RasaTalk/app/containers/App/index.js
Line 58 in 95e544a
That should allow you to bypass authentication for logging in.
Then you can change
RasaTalk/server/authentication/guard.js
Line 10 in 95e544a
to if (true)