Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Line for foundation emails not working on Node 12 #11755

Closed
3 tasks done
xaddict opened this issue May 21, 2019 · 10 comments
Closed
3 tasks done

Command Line for foundation emails not working on Node 12 #11755

xaddict opened this issue May 21, 2019 · 10 comments

Comments

@xaddict
Copy link

xaddict commented May 21, 2019

What should happen?

The CLI should ask me for a project name and create the foundation emails project for me

What happens instead?

I get the following error message:

fs.js:27
const { Math, Object } = primordials;
                         ^
ReferenceError: primordials is not defined
    at fs.js:27:26
    at req_ (/usr/local/lib/node_modules/foundation-cli/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/usr/local/lib/node_modules/foundation-cli/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/foundation-cli/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)

Also, when I was installing the foundation CLI I got the following warnings:

npm WARN deprecated bower@1.8.8: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
/usr/local/bin/foundation -> /usr/local/lib/node_modules/foundation-cli/bin/foundation.js
+ foundation-cli@2.2.5

Possible Solution

It probably has to do with the newer NodeJS version and the fact the tool is using Bower.
The warnings also show that graceful-fs 3.0.11 is not recommended for newer NodeJS versions. The same point applies to natives@1.1.6 as that has been deprecated.

How to reproduce:

  1. sudo npm install --global foundation-cli in the terminal
  2. cd to a projects folder
  3. use foundation new --framework emails to get the error

Context

I want to use the sass version of Foundation Emails and would like to use Inky as a templating language. I can use Inky standalone, but having the project CLI would make it easier to use.

Your Environment

  • Foundation version(s) used: latest
  • Device, Operating System and version: iMac 27 inch 2017, macOS Mojave 10.14.4
  • NodeJS 12.2.0
  • NPM 6.9.0

Checklist

  • I have read and follow the CONTRIBUTING.md document.
  • There are no other issues similar to this one.
  • The issue title and template are correctly filled.
@DanielRuf
Copy link
Contributor

Hi @xaddict,

Also, when I was installing the foundation CLI I got the following warnings:

Warnings are ok.

primordials is a native Node.js core part and there were changes in 11+ regarding this. Please use Node.js 10.

@xaddict
Copy link
Author

xaddict commented May 21, 2019

Unfortunately I'm unable to use Node 10 as this is an active project.

@DanielRuf
Copy link
Contributor

Which OS do you use? You can use nodenv and nvm to switch the version.

@DanielRuf
Copy link
Contributor

DanielRuf commented May 22, 2019

Closing as this should be reported in the foundation-cli issues:
https://github.com/zurb/foundation-cli/issues

Otherwise we would make it harder for maintainers and contributors to keep these projects separated.

Please report it in the foundation-cli repository.

https://stackoverflow.com/a/56253873/753676

I guess you use NodeJS 12.
NodeJS 12 is not supported by the current CLI. Please use NodeJS 10.

primordials is part of the natives package and called in the graceful-fs package as you can see in the stacktrace.

You can try to upgrade the graceful-fs dependency from 3 to 4 but this might not work without other changes.

This is in fs.js of graceful-fs 3:

module.exports = require('natives').require('fs', ['stream'])

From the natives page on npmjs.com:

This package has been deprecated
Author message:

This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.

Also see https://travis-ci.com/DanielRuf/foundation-cli-test/builds/112738932

Bildschirmfoto 2019-05-22 um 12 06 03
Bildschirmfoto 2019-05-22 um 12 06 32

Compare this to the environment where we have NodeJS 10 (the team of gulp has deleted the 4.0 tag, you can change the line in package.json to reference gulp 4.0.0):

Bildschirmfoto 2019-05-22 um 12 07 05

@DanielRuf DanielRuf changed the title Command Line for foundation emails not working on Node 12 (bower, graceful-fs, natives mentions) Command Line for foundation emails not working on Node 12 May 22, 2019
@DanielRuf
Copy link
Contributor

yarn why graceful-fs
yarn why v1.15.2
[1/4] 🤔  Why do we have the module "graceful-fs"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "graceful-fs@3.0.11"
info Has been hoisted to "graceful-fs"
info Reasons this module exists
   - Specified in "dependencies"
   - Hoisted from "update-notifier#configstore#graceful-fs"
info Disk size without dependencies: "56KB"
info Disk size with unique dependencies: "76KB"
info Disk size with transitive dependencies: "76KB"
info Number of shared dependencies: 1
...
yarn why natives               
yarn why v1.15.2
[1/4] 🤔  Why do we have the module "natives"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "natives@1.1.6"
info Reasons this module exists
   - "graceful-fs" depends on it
   - Hoisted from "graceful-fs#natives"
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "20KB"
info Disk size with transitive dependencies: "20KB"
info Number of shared dependencies: 0

@DanielRuf
Copy link
Contributor

DanielRuf commented May 22, 2019

All projects can not be built on NodeJS 12, see https://travis-ci.com/DanielRuf/foundation-cli-test/builds/112830315

So it's best to use NodeJS 10.

@derkhadim
Copy link

What should happen?

The CLI should ask me for a project name and create the foundation emails project for me

What happens instead?

I get the following error message:

fs.js:27
const { Math, Object } = primordials;
                         ^
ReferenceError: primordials is not defined
    at fs.js:27:26
    at req_ (/usr/local/lib/node_modules/foundation-cli/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/usr/local/lib/node_modules/foundation-cli/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/foundation-cli/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)

Also, when I was installing the foundation CLI I got the following warnings:

npm WARN deprecated bower@1.8.8: We don't recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
/usr/local/bin/foundation -> /usr/local/lib/node_modules/foundation-cli/bin/foundation.js
+ foundation-cli@2.2.5

Possible Solution

It probably has to do with the newer NodeJS version and the fact the tool is using Bower.
The warnings also show that graceful-fs 3.0.11 is not recommended for newer NodeJS versions. The same point applies to natives@1.1.6 as that has been deprecated.

How to reproduce:

  1. sudo npm install --global foundation-cli in the terminal
  2. cd to a projects folder
  3. use foundation new --framework emails to get the error

Context

I want to use the sass version of Foundation Emails and would like to use Inky as a templating language. I can use Inky standalone, but having the project CLI would make it easier to use.

Your Environment

  • Foundation version(s) used: latest
  • Device, Operating System and version: iMac 27 inch 2017, macOS Mojave 10.14.4
  • NodeJS 12.2.0
  • NPM 6.9.0

Checklist

  • I have read and follow the CONTRIBUTING.md document.
  • There are no other issues similar to this one.
  • The issue title and template are correctly filled.

Install nvm and user node10 lts.

@DanielRuf
Copy link
Contributor

@derkhadim #11755 (comment) ;-)

@romanmarkelov
Copy link

romanmarkelov commented Sep 27, 2019

workaround: npx -p node@10 foundation new --framework emails

@mlangone
Copy link

mlangone commented Oct 9, 2019

You can use n for node's version management. There is a simple intro for n.

$ sudo npm cache clean -f
$ npm install -g n
$ n 10
sudo may need to be use.

Then you can show your node version:

$ node -v
$ v10.16.3

From here

Have to use npx -p node@10 foundation new --framework emails
change package.json
"gulp": "github:gulpjs/gulp#v4.0.0",
"gulp-sass": "^2.1.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants