rblopes / generator-phaser-plus

[🛑 DISCONTINUED] It has been a long journey but development of `generator-phaser-plus` is now over. I recommend you have a look and fork `yandeu/phaser-project-template` instead.
https://github.com/yandeu/phaser-project-template
MIT License
144 stars 14 forks source link

Problem with lib/post_install.js and gulp? #27

Open philandy opened 6 years ago

philandy commented 6 years ago
> node lib/post_install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"android","arch":"arm"})

added 976 packages in 178.255s

Congrats! Now, launch your project using
npm start and happy hacking :)
$ npm start

> @ start /data/data/com.termux/files/.../testproject2
> gulp

sh: 1: gulp: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ start: `gulp`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /data/data/com.termux/files/home/.npm/_logs/2018-02-21T07_23_40_153Z-debug.log

Tried a yarn add gulp

success Saved 689 new dependencies.
...
├─ gulp-util@3.0.8
├─ gulp@3.9.1
├─ gulplog@1.0.0

Yet still getting gulp not found?

Also having trouble with fsevents so that might explain some of it. Thanks! So close though.

rblopes commented 6 years ago

It looks like you're using Termux, an dev environment I'm not familiar with. I may not be able to provide a suitable solution for your issue, but I'll try it anyway.

In general, the warnings you see after the installation should go away running npm dedupe. fsevents, as is said in the messages, is required only on MacOS, so it shouldn't be a problem.

The sample projects are using Gulp 4, not 3. It shouldn't be necessary, however in case you have overridden the default installation, install Gulp 4 again with npm install gulp@next. Also, gulp-cli may be a good addition, so install it globally.

Now for the part I'm not sure I can help much. For some reason, npm seems to be not adding your project to its own PATH. To check that, add a little test script to your project package.json with the following command:

{
  "scripts": {
    "path": "echo $PATH | tr ':' '\n'"
  },
}

It should print a path with .../<my-project>/node_modules/.bin in normal situations, meaning it can find the .bin directory of your node_modules and use the scripts copied (linked) there. A fallback could be to change all scripts to ./node_modules/.bin/gulp .... It could be a permission issue too, I'm not sure.

philandy commented 6 years ago

I'm probably doing NPM wrong then, wow. Sorry. I tried npm install gulp@next and now my CWD has a new directory in it; was assuming npm would update to it's own home directory of its choosing. How would I roll that back to undo that change?

rblopes commented 6 years ago

Do you mean that that new dir is node_modules? You said you installed Gulp using Yarn before, maybe that's why it's there. If npm is conceived to work differently on that platform, then you should stick to it. Mixing Yarn and npm may be a bad idea. You could try removing that created node_modules directory and the eventual yarn.lock file Yarn creates.

Everything else is beyond my possibilities here. Like I said before, I know close to nothing about Termux and its intricacies. I'm not able to reproduce your issue at the moment either, so best I can do is guess. In this case, the Termux app community can provide you with better support and point you in the right direction.