1

I'm trying to use npm's "local paths" feature but I'm getting the error:

ERROR in ./src/pixi-environment/src/pixi-environment.js Module not found: Error: Can't resolve 'pixi.js' in '/Users/michaelosofsky/Developer/develop/locuslabs-js-sdk/src/pixi-environment/src'

I think I've set it all up correctly by following https://stackoverflow.com/a/14387210/2848676 and https://stackoverflow.com/a/42430086/2848676:

  1. The local path relative to my project is ../../pixi.js_prerelease

  2. From my project directory I installed with the command npm install --save ~/Developer/pixi.js_prerelease

  3. My project's package.json got automatically updated with a dependency "pixi.js": "file:../../pixi.js_prerelease",

  4. My project's node_modules directory automatically got a subdirectory called pixi.js created and it contains the files from ~/Developer/pixi.js_prerelease

  5. The file that imports pixi.js does it like this:

    const PIXI = require('pixi.js')

I also tried these approaches:

const PIXI = require('./node_modules/pixi.js/pixi.js')

const PIXI = require('./node_modules/pixi.js')

const PIXI = require('../../../node_modules/pixi.js/pixi.js')

const PIXI = require('../../../node_modules/pixi.js')

const PIXI = require('~/Developer/pixi.js_prerelease/pixi.js')

const PIXI = require('~/Developer/pixi.js_prerelease')

const PIXI = require('/Users/michaelosofsky/Developer/pixi.js_prerelease/pixi.js')

const PIXI = require('/Users/michaelosofsky/Developer/pixi.js_prerelease')

However, when I do npm test in my project's directory I get the error above.

Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113

0 Answers0