I am setting up a new web app with feathersjs as the back end and Vue + feathers client (feathers-vuex) as my front end. However, after installing the packages using npm, I am getting multiple import errors as follows -
Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type
This is happening for the following modules (including npm install command):
Frontend:
#feathersjs/feathers
#feathersjs/socketio-client
socket.io-client
#feathersjs/authentication-client
feathers-vuex --save
Backend:
feathers-sequelize
feathersjs-authentication
feathersjs-authentication-local
I looked at this stackoverflow question
Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type
I tried to install types from #types which worked for some of the modules except for: feathers-sequelize (Backend) and feathers-vuex (Frontend)
It seems *.d.ts file is not created for either and that is what is missing from my current setup.
Is there something basic that I am missing? I am new to the world of node.js and feathersjs so apologies for any noob mistakes!
Related
I tried creating a contact form with SMTP js in react but it did not work tried checking stack over flow but no good answer for using only react not typescript
I was expecting the stmp is to be installed like normal swiper
Because I'm still a junior frontend dev 🤧
You can also find more information and documentation on using smtp.js in React app on the following resources:
Official smtp.js documentation: https://github.com/kimmobrunfeldt/smtp.js
SMTP in Node.js: https://nodemailer.com/smtp/
this also explains better:
https://victorbruce82.medium.com/how-to-send-emails-using-react-through-emailjs-no-server-code-needed-8e1453ef8796
Yes, you can install smtp.js in a similar way to installing other packages in your React app. You can use npm or yarn to install it:
CODE :
npm install smtpjs
or
yarn add smtpjs
After installation, you can import and use smtp.js in your React component.
In my app.json folder, I have everything bundled nicely, but I have one undefined package at the bottom of the install list:
"undefined": "react-navigation/bottom-tabs"
I tried running an "npm install react-navigation/bottom-tabs" but it threw this error:
warn Package undefined has been ignored because it contains invalid configuration. Reason: Cannot find module 'undefined/package.json'
Has anyone encountered an issue like this before? I am running React-Native Version 5 on top of Expo.
EDIT: It turns out that it was supposed to be #react-navigation/bottom-tabs, so I installed that and made an adjustment; but now I am still stuck with the original undefined package in my app.json folder, and cannot get rid of it.
So, I forgot this post existed and I actually figured this out months ago. When you're dealing with:
A bad bundle,
the wrong version,
or there's just something wrong with your 'package.json' file, (the file that contains the list of your packages)
These steps should fix it:
Perform "npm uninstall 'package-name' " or "yarn remove 'package-name'"
Note: You do this instead of 'expo-uninstall' because 'expo-uninstall' does not exist. We use 'expo-install' instead of 'npm' or 'yarn' install to make sure you download the proper npm or yarn version associated with your version of expo.
Open the package.json file and see if the bad package you uninstalled is still present.
If the bad package is still there, select and delete it from the file, then save.
Run an "expo" "npm" or "yarn" install on the correct package name
This should fix it. This is best fixed when step 4 is executed with an 'expo install' as you likely have an incompatible version of the package, so this will prevent that from happening again.
In my case, I couldn't figure out why my terminal was telling me a specific package didn't exist, so I did a "sud" command to force download the package. This package didn't exist, because I had actually spelled it wrong.
try deleting your node modules and install them again and make sure your metro is closed
clear cache and you are good to go by the way it worked for me
npm install or yarn add
npm start --reset-cache
I have a problem with a requirement, hope you can help me.
I have 1 package named #unicoderns/orm, that requires mysql
https://github.com/unicoderns/ORM
Now Im trying to code another OpenSource package named #unicoderns/cerberus, cerberus has the orm as dependency, but when I try to build cerberus I get this error:
node_modules/#unicoderns/orm/connection.d.ts:4:24 - error TS7016: Could not find a declaration file for module 'mysql'. '/home/chriss/Sites/cerberus/node_modules/mysql/index.js' implicitly has an 'any' type.
Try npm install #types/mysql if it exists or add a new declaration (.d.ts) file containing declare module 'mysql';
4 import * as mysql from "mysql";
Is obviously trying to find the types of mysql in Ceberus, but they dont exists, why?
Edit 1: typo
#unicoderns/orm lists #types/mysql in its devDependencies, so #types/mysql gets installed when you run npm install directly in #unicoderns/orm, but not when you run npm install in another package that depends on #unicoderns/orm (such as #unicoderns/cerberus). If #unicoderns/orm is going to have a declaration file such as connection.d.ts that references declarations from #types/mysql and is intended to be loaded by dependent packages, then the recommendation is to put #types/mysql in the regular dependencies of #unicoderns/orm to avoid the problem you saw.
I'm using the skeleton-typescript aurelia skeleton-navigation package, when running gulp bundle it gives me an error that says path must be a string but was undefined
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.basename (path.js:801:5)
at exports.writeOutputs (C:\Users\joaoe\Desktop\skeleton-navigation\skeleton-typescript\node_modules\systemjs-builder\lib\output.js:137:23)
at C:\Users\joaoe\Desktop\skeleton-navigation\skeleton-typescript\node_modules\systemjs-builder\lib\builder.js:575:14
at tryCatcher (C:\Users\joaoe\Desktop\skeleton-navigation\skeleton-typescript\node_modules\systemjs-builder\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\joaoe\Desktop\skeleton-navigation\skeleton-typescript\node_modules\systemjs-builder\node_modules\bluebird\js\release\promise.js:502:31)
All gulp related files can be found here since there are more than one.
Even the cloned package throw that.
I'm running Node 6.0.0 and tested with 5.9.1, on Windows 10.
There is some property that I need set to be that path ? Seems related to Aurelia pre built tasks, from comments could also be an environment problem.
As I tracked it down, the issues seems to be an ugly combination of node-gyp, Windows and node 6
So install all dependencies needed for node-gyp, following your OS steps as seen at official repo. Unfortunately for now if you are running Windows is likely that you need to install Visual Studio. Then run npm install on the repository and see if there is any error, should be no one now. Then try to gulp bundle it should work now. With downgraded node to 5.11 I was able to run again, I did not test with node 6 but feel free to try.
When I'm trying to start a new react-native project from scratch I'm getting this message.
/Users/jorgevenegas/Dev/Projects/testreact/List/node_modules/react-native/node_modules/babel-core/lib/transformation/file/options/option-manager.js:327
throw new Error("Couldn't find preset " + JSON.stringify(val) + " relative to directory " + JSON.stringify(dirname));
^
Error: Couldn't find preset "es2015" relative to directory "/Users/jorgevenegas/Dev/Projects"
I have installed react-native-cli, of course. Using node v4.2.1, react-native 0.1.5, watchman and flow installed too.
Seems to be something related to babel. I can't figure out the reason, though.
I'm attaching a screenshot with a more detailed output.
Thanks in the advance!
This bugged me for a good 1 day. The issue was I had a .babelrc file up in my file hierarchy which was interfering with babel parsing. Got rid of that and it was fine. react-native uses es2015 by default so .babelrc is not required.
Try installing the following packages
npm install babel-preset-es2015 --save
npm install babel-preset-react --save
I had the same problem.
The solution for me was to switch from 'workspace/MyProject' (for you its "/Users/jorgevenegas/Dev/Projects" i guess) to 'workspace'.
I don't know why I had to do this, but when i ran
npm install babel-preset-es2015
npm install babel-preset-react
in my workspace instead, i could cd into 'MyProject' again and execute a react-native run-android from there.
Hope that helps at least some people encountering the same problem.
Add the following line to your .babelrc file:
{"presets": ["react"]}
I find solution from babel.io
I went through something similar, maybe this can help. In my case it was because for some reason I had two instances of react-native installed on my system.
Check the output of
which -a react-native
If you get more than one path with react native installed, get rid of the one that gives you the same error when executing init directly with the full path (my case was one installed at /usr/local/bin/react-native, but yours could be slightly different).
After removing the wrong one, you should be able to init projects without any problems.