pattern-lab / edition-node-gulp

ARCHIVED - The gulp wrapper around patternlab-node core, providing tasks to interact with the core library and move supporting frontend assets.
MIT License
279 stars 111 forks source link

Postinstall error prevents use of edition-node-gulp (v1.3.1) as a dependency #77

Closed teehemkay closed 7 years ago

teehemkay commented 8 years ago

I am using Pattern Lab Node- Gulp Edition v1.3.0 and 'v1.3.1' on Mac|Linux.

Expected Behavior

Running

cd install/location/
npm install eedition-node-gulp

should install eedition-node-gulp as a dependency

Actual Behavior

Instead I get the following error message:

> edition-node-gulp@1.3.1 postinstall [...]/component-library/node_modules/edition-node-gulp
> node node_modules/patternlab-node/core/scripts/postinstall.js

module.js:457
    throw err;
    ^

Error: Cannot find module '[...]/component-library/node_modules/edition-node-gulp/node_modules/patternlab-node/core/scripts/postinstall.js'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
npm WARN enoent ENOENT: no such file or directory, open '[...]/component-library/package.json'
Steps to Reproduce
cd install/location/
npm install eedition-node-gulp

The error seems to be that node is looking for the patternlab-node package in the node_modules subdirectory under edition-node-gulp instead of looking in the my project node_modules subdirectory (which contains both the patternlab-node and edition-node-gulp packages)

mremergo commented 8 years ago

same error

Karla-Isabel-Sandoval commented 8 years ago

I am also getting the same error. Running node v6.6.0

`~/courseraAlgorithms $ node courseraTestCode.js module.js:457 throw err; ^

Error: Cannot find module '/Users/Hyacinth/courseraAlgorithms/courseraTestCode.js' at Function.Module._resolveFilename (module.js:455:15) at Function.Module._load (module.js:403:25) at Module.runMain (module.js:590:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3`

I have uninstalled node. Reinstalled it. Ran a brew doctor. Cleared up all issues. Can't seem to figure out what is causing this issue. I need to make sure I can use node for my assignments.

bmuenzenmeyer commented 8 years ago

@Karla-Isabel-Sandoval what does your output have to do with Pattern Lab Node or this edition? I am not understanding.

Karla-Isabel-Sandoval commented 8 years ago

@bmuenzenmeyer i'm getting a very similar error message to @teehemkay's and I figured this would be a good thread to watch in case there's a solution and or possible feedback .

bmuenzenmeyer commented 7 years ago

ok @Karla-Isabel-Sandoval I was just confused because nowhere does your stack trace mention patternlab. is it part of coursera work? (cool!)

bmuenzenmeyer commented 7 years ago

Just to clarify - this isn't supposed to be working right now. For the time being, the only way to use Pattern Lab Node Editions is as standalone projects.

You can still download the package or clone the repo and run npm install, but running npm install edition-node-gulp will likely not work until the CLI is more fully baked as part of https://github.com/pattern-lab/patternlab-node/milestone/20

bmuenzenmeyer commented 7 years ago

@teehemkay @mremergo @Karla-Isabel-Sandoval feel free to re-try. Don't know if it will work perfectly without changing your package.json's patternlab-node entry to "patternlab-node": "2.6.0-alpha" for the shortterm

teehemkay commented 7 years ago

@bmuenzenmeyer

Thanks for the update and sorry for the late response...

I tried a fresh install per the instructions on the README

cd install/location/
npm install edition-node-gulp

I still get a failure (no throw though) with the following message.

> edition-node-gulp@1.3.2 postinstall /[...]/pl/node_modules/edition-node-gulp
> node scripts/postinstall.js

Beginning Pattern Lab Node Gulp postinstall...
Beginning Pattern Lab postinstall...
 { Error: ENOENT: no such file or directory, scandir '/[...]/pl/node_modules/edition-node-gulp/node_modules'
    at Error (native)
    at Object.fs.readdirSync (fs.js:951:18)
    at detectStarterKits (/[...]/pl/node_modules/patternlab-node/core/lib/starterkit_manager.js:54:26)
    at Object.detect_starterkits (/[...]/pl/node_modules/patternlab-node/core/lib/starterkit_manager.js:72:14)
    at Object.<anonymous> (/[...]/pl/node_modules/patternlab-node/core/scripts/postinstall.js:17:45)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/[...]/pl/node_modules/edition-node-gulp/node_modules' }
 An error occurred during Pattern Lab Node postinstall.
 Pattern Lab postinstall completed with errors.

Looking at the code in starterkit_manager.js

    var node_modules_path = path.join(process.cwd(), 'node_modules');
    var npm_modules = fs.readdirSync(node_modules_path)...

there seem to be an incorrect assumption that there will be a node_modules subdir under ./node_modules/edition-node-gulp/ (== process.cwd()). But this is not necessarily the case when doing a fresh install using npm>= 3 as outline above.

OTHO, I don't know if it's related but I'm not sure I understand what you mean by

"Don't know if it will work perfectly without changing your package.json's patternlab-node entry to "patternlab-node": "2.6.0-alpha" for the shortterm

I don't have patternlab-node in my package.json, just edition-node-gulp (which in turn depends on patternlab-node).