[SOLVED] Npm ERR! on meteor npm install --save https:


#1

Well, so far I managed to make Meteor 1.4.1.2 work on my Linux Mint 18 but now, when I try:
meteor npm install --save https:

I get:

npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/home/pm/.meteor/packages/meteor-tool/.1.4.1_2.354htk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node" "/home/pm/.meteor/packages/meteor-tool/.1.4.1_2.354htk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm" "install" "--save" "https:"
npm ERR! node v4.6.0
npm ERR! npm  v3.10.8

npm ERR! Cannot read property 'replace' of null
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pm/Documents/test/npm-debug.log

any idea?

In case you want the npm-debug.log, here’s the end:

18 verbose stack     at FSReqWrap.oncomplete (fs.js:82:15)
19 verbose cwd /home/pm/Documents/test
20 error Linux 4.4.0-21-generic
21 error argv "/home/pm/.meteor/packages/meteor-tool/.1.4.1_2.354htk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node" "/home/pm/.meteor/packages/meteor-tool/.1.4.1_2.354htk++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm" "install" "--save" "https:"
22 error node v4.6.0
23 error npm  v3.10.8
24 error Cannot read property 'replace' of null
25 error If you need help, you may report this error at:
25 error     <https://github.com/npm/npm/issues>
26 verbose exit [ 1, true ]

Here’s why I tried the npm install --save after running meteor:

Unable to resolve some modules:

  "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js" in
/home/pm/Documents/test/client/main.js (web.browser)
  "https://netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" in
/home/pm/Documents/test/client/main.js (web.browser)
                                              
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"
in /home/pm/Documents/test/client/main.js (web.browser)
  "https://pingendo.github.io/pingendo-bootstrap/themes/default/bootstrap.css"
in /home/pm/Documents/test/client/main.js (web.browser)
  "https://cdn-images.mailchimp.com/embedcode/classic-10_7.css" in
/home/pm/Documents/test/client/main.js (web.browser)
                                              
If you notice problems related to these missing modules, consider running:
                                              
  meteor npm install --save https:

How to import a css framework into the app?
#2

What are you trying to do?

AFAIK “https:” is not a valid npm module.


#3

Thanks Rob,
I followed Meteor guide (https://guide.meteor.com/structure.html#special-directories) to import external js and css like:
import ‘https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js’;


#4

Unfortunately, this message:

If you notice problems related to these missing modules, consider running:

meteor npm install --save xxx

is misleading. It’s issued anytime you try to import something it can’t find - whether or not it’s an npm module.

jQuery is currently available in Meteor by default (although that may change). To make sure it’s available first do meteor add jquery on the command line and then in your code use $ in the usual way.

If that’s not what you’re trying to do, please share your code and we’ll help.


#5

It is so easy to use client/compatibility for head scripts, I thought it evolved a lot :slight_smile:
My import was nonsense, you’re right I can use bootstrap and jQuery modules but what about css?
Is it possible to call external websites for additional css?
How?


#6

Create a head.html file in your client/ directory with only one <head> tag and import those CSS files normally using <link> tabs:

<head>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
  <link rel="stylesheet" href="https://pingendo.github.io/pingendo-bootstrap/themes/default/bootstrap.css">
  <link rel="stylesheet" href="https://cdn-images.mailchimp.com/embedcode/classic-10_7.css">
</head>

Those will be merged with other tags in <head> section that Meteor automatically generates.

Note that for Bootstrap you can actually install it with Meteor’s package manager by running command: meteor add twbs:bootstrap


#7

Oh!
Thank you M4v3R, it works!
For other users, it’s not in official Meteor guide but found more details at:
https://themeteorchef.com/snippets/organizing-your-meteor-project/


#8

Here’s a note about this in the guide (under “client” heading): https://guide.meteor.com/structure.html#special-directories

HTML files in a Meteor application are treated quite a bit differently from a server-side framework. Meteor scans all the HTML files in your directory for three top-level elements: <head>, <body>, and <template>. The head and body sections are separately concatenated into a single head and body, which are transmitted to the client on initial page load.