jspm / npm

NPM Location Service
19 stars 34 forks source link

error installing mockfirebase #112

Closed xtreemrage closed 8 years ago

xtreemrage commented 8 years ago

Testing out JSPM and trying to install my bower packages, getting an error with one of them: mockfirebase (jspm install npm:mockfirebase). Installing with just jspm install mockfirebase resulting in a:

err  Repo jspm:mockfirebase not found. Perhaps try jspm install npm:mockfirebase.

This is the error when I try it with the suggested tip:

err  TypeError: toMap.startsWith is not a function
         at applyMap (E:\workspace\test-jspm\node_modules\jspm\lib\build.js:251:15)
         at E:\workspace\test-jspm\node_modules\jspm\lib\build.js:527:30
         at String.replace (native)
         at RegExp.<anonymous> (E:\workspace\test-jspm\node_modules\core-js\modules\$.fix-re-wks.js:20:48)
         at String.replace (E:\workspace\test-jspm\node_modules\core-js\modules\es6.regexp.replace.js:9:12)
         at E:\workspace\test-jspm\node_modules\jspm\lib\build.js:524:31
         at lib$rsvp$$internal$$tryCatch (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:493:16)
         at lib$rsvp$$internal$$invokeCallback (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:505:17)
         at lib$rsvp$$internal$$publish (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:476:11)
         at lib$rsvp$asap$$flush (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:1198:9)
         at nextTickCallbackWith0Args (node.js:433:9)
         at process._tickCallback (node.js:362:13)

warn Installation changes not saved.
OS = windows 10
node = 5.3.0
npm = 3.5.1
jspm = 0.16.19

Installing with npm or bower works like a charm, jspm not... Any one knows what is happening and how ot fix it ;-)?

guybedford commented 8 years ago

jspm install npm:mockfirebase is working fine for me. Are you sure the version is 0.16.19 in jspm -v? Perhaps try jspm install npm:mockfirebase -f to install without the cache?

xtreemrage commented 8 years ago

I use it on windows 10 if that is of any help. I tried your suggestion and it didn't work, I got the same error (and yes I'm sure that jspm -v gives me 0.16.19). Halfway trough the installation, of mockfirebase, I get this:

ok   Installed npm:date-now@^0.1.4 (0.1.4)
ok   Installed npm:resolve@~0.7.1 (0.7.4)

warn TypeError: toMap.startsWith is not a function
         at applyMap (E:\workspace\test-jspm\node_modules\jspm\lib\build.js:251:15)
         at E:\workspace\test-jspm\node_modules\jspm\lib\build.js:527:30
         at String.replace (native)
         at RegExp.<anonymous> (E:\workspace\test-jspm\node_modules\core-js\modules\$.fix-re-wks.js:20:48)
         at String.replace (E:\workspace\test-jspm\node_modules\core-js\modules\es6.regexp.replace.js:9:12)
         at E:\workspace\test-jspm\node_modules\jspm\lib\build.js:524:31
         at lib$rsvp$$internal$$tryCatch (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:493:16)
         at lib$rsvp$$internal$$invokeCallback (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:505:17)
         at lib$rsvp$$internal$$publish (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:476:11)
         at lib$rsvp$asap$$flush (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:1198:9)
         at nextTickCallbackWith0Args (node.js:433:9)
         at process._tickCallback (node.js:362:13)

    Looking up npm:is-buffer
    Looking up npm:lexical-scope
    Looking up npm:stream-combiner2

And then eventually the first error I reported:

ok   Installed npm:browserify@^12 (12.0.1)

err  TypeError: toMap.startsWith is not a function
         at applyMap (E:\workspace\test-jspm\node_modules\jspm\lib\build.js:251:15)
         at E:\workspace\test-jspm\node_modules\jspm\lib\build.js:527:30
         at String.replace (native)
         at RegExp.<anonymous> (E:\workspace\test-jspm\node_modules\core-js\modules\$.fix-re-wks.js:20:48)
         at String.replace (E:\workspace\test-jspm\node_modules\core-js\modules\es6.regexp.replace.js:9:12)
         at E:\workspace\test-jspm\node_modules\jspm\lib\build.js:524:31
         at lib$rsvp$$internal$$tryCatch (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:493:16)
         at lib$rsvp$$internal$$invokeCallback (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:505:17)
         at lib$rsvp$$internal$$publish (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:476:11)
         at lib$rsvp$asap$$flush (E:\workspace\test-jspm\node_modules\rsvp\dist\rsvp.js:1198:9)
         at nextTickCallbackWith0Args (node.js:433:9)
         at process._tickCallback (node.js:362:13)

warn Installation changes not saved.
xtreemrage commented 8 years ago

I have also tried it with cygwin on my machine, but no luck. Someone?!

xtreemrage commented 8 years ago

I also tried it on my ubuntu 14.04 machine, no luck (same error as above). @guybedford on what machine did you tried it on and what are your tooling (node/npm/jspm) versions?

Versions on my ubuntu machine:

node -v = v5.3.0
npm -v = 3.3.12
jspm --version = 0.16.19
guybedford commented 8 years ago

Since this works fine on my fresh jspm install, the only thing I can think is a core-js breaking change or a custom override. I reinstalled my local jspm and tried again but still don't get the issue. Have you got any custom overrides in place at all in the package.json?

xtreemrage commented 8 years ago

No overrides in my package.json file, only in my bower.json file (disabled it just to be sure). No luck -_-, to bad.

Then I thought to catch the undefined error in jspm\lib\build.js, then run the install command, it at least installed, but now all the paths are wrong... I can not call the import with mockfirebase, I need to explicitly call jspm_packages/npm/mockfirebase@0.12.0/src.js, but those have also references to other packages, and those need to be called explicitly to... So no luck yet...

@guybedford Do you use a specific node/npm version?

p.s. I can install/use it mockfirebase just fine with npm and bower.

xtreemrage commented 8 years ago

I have tried it in a empty test folder, run npm init then npm install -S jspm and then tried jspm install npm:mockfirebase. The same error as above. See below my config, do I miss something.

This is the package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "test description",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "jspm": {
    "devDependencies": {
      "babel": "npm:babel-core@^5.8.24",
      "babel-runtime": "npm:babel-runtime@^5.8.24",
      "core-js": "npm:core-js@^1.1.4"
    }
  },
  "dependencies": {
    "jspm": "^0.16.19"
  }
}

This is the config.js file:

System.config({
  baseURL: "/",
  defaultJSExtensions: true,
  transpiler: "babel",
  babelOptions: {
    "optional": [
      "runtime",
      "optimisation.modules.system"
    ]
  },
  paths: {
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*"
  },

  map: {
    "babel": "npm:babel-core@5.8.34",
    "babel-runtime": "npm:babel-runtime@5.8.34",
    "core-js": "npm:core-js@1.2.6",
    "github:jspm/nodelibs-assert@0.1.0": {
      "assert": "npm:assert@1.3.0"
    },
    "github:jspm/nodelibs-path@0.1.0": {
      "path-browserify": "npm:path-browserify@0.0.0"
    },
    "github:jspm/nodelibs-process@0.1.2": {
      "process": "npm:process@0.11.2"
    },
    "github:jspm/nodelibs-util@0.1.0": {
      "util": "npm:util@0.10.3"
    },
    "npm:assert@1.3.0": {
      "util": "npm:util@0.10.3"
    },
    "npm:babel-runtime@5.8.34": {
      "process": "github:jspm/nodelibs-process@0.1.2"
    },
    "npm:core-js@1.2.6": {
      "fs": "github:jspm/nodelibs-fs@0.1.2",
      "path": "github:jspm/nodelibs-path@0.1.0",
      "process": "github:jspm/nodelibs-process@0.1.2",
      "systemjs-json": "github:systemjs/plugin-json@0.1.0"
    },
    "npm:inherits@2.0.1": {
      "util": "github:jspm/nodelibs-util@0.1.0"
    },
    "npm:path-browserify@0.0.0": {
      "process": "github:jspm/nodelibs-process@0.1.2"
    },
    "npm:process@0.11.2": {
      "assert": "github:jspm/nodelibs-assert@0.1.0"
    },
    "npm:util@0.10.3": {
      "inherits": "npm:inherits@2.0.1",
      "process": "github:jspm/nodelibs-process@0.1.2"
    }
  }
});
guybedford commented 8 years ago

I'm running Node v5 here, but it shouldn't make a difference.

Perhaps try adding a console.log statement to that line to see what the value of toMap is in https://github.com/jspm/jspm-cli/blob/master/lib/build.js#L251?

My suspicion is that it is undefined, and not a string which is causing the issue. In turn that would be due to a problem in the package configuration, hence my override suggestion.

But if it's not that then that would be interesting to know too.

xtreemrage commented 8 years ago

@guybedford Sorry for the late reply, hadn't had the time to test it sooner. But I updated my stuff (node/npm/jspm).

node -v = v5.4.1
npm -v = 3.3.12
jspm -v = 0.16.23

I can install it now, but... now I have another problem. Whe I try to use mockfirebase, I get an 404, it can't find the file when I startup my browser (mockfirebase@0.12.0.js). When I look in the jspm_packages\npm folder I don't see mockfirebase@0.12.0.js, I can see other plugins that I have installed (like stacktrace.js). So I needed to manually create the file and point it to the mockfirebase@0.12.0 folder that jspm created in the jspm_packages\npm folder for me.

But I don't get this module fully to work, even after manually creating the stuff.

guybedford commented 8 years ago

@xtreemrage this would be due to the package main entry point not being configured correctly. See the override docs for setting this on install.