or to import any other npm package with this command. I have already installed the package via meteor npm install --save simpl-schema.
I have also tried to import other npm dependencies like:
import moment from 'moment';
Therefore, I think that I generally missed something important to be able to require NPM packages in my client-side code or that I am using a wrong structure?
I get the error:
Uncaught SyntaxError: Unexpected identifier
in the browser console.
I would appreciate any help, thanks!
iirc, to use Node packages on the client, you need to install meteor-node-stubs or something like that? Also it might be worth double checking and making sure that something else isnāt throwing the error.
Thanks for the reply, but I now installed meteor-node-stubs with meteor npm install --save meteor-node-stubs and still get this error. However, I only get this error if I have the import command in my code. Any other suggestions?
So, you are right. I was missing the ecmascript package. But I think that I am missing several important packages or dependencies, because after I installed ecmascript, I got another error message which told me that my bootstrap is not compatible with my jquery version. I solved this issue by using meteor npm install --save jquery@2.2.4.
Maybe you know which āstandardsā have to be installed or how to āresetā my project in a way, that I can use import and all these things? Actually, I donĀ“t know what leads to these errors.
I have attached the output of meteor list in a screenshot.
OK, got it! Although I donĀ“t know exactly what produced the error, I could solve the issue by creating a new meteor project with the--bare flag (so now I know that all npm dependencies are installed correctly to ensure that I can use 'import') and copied my code into the project. I still got the bootstrap and jquery error, but instead of installing jquery 2.2.4, I deleted codemirror in my client/vendor folder which produces the third error
first and than installedjquery@2.2.4 plus all required datatable npm dependencies I use in my code. Now I can use import SimpleSchema from 'simpl-schema' and all other imports and no more errors occure.
So lastly, some npm and/or packages were wrong and the initial error could be solved by creating a new meteor project. The other errors were related to bootstrap/jquery compatibility and codeMirror.