Create a fresh Drupal 10 project.
Two options, Download Drupal 10 directly: https://www.drupal.org/project/drupal/releases/10.0.0
Alternatively, use Composer https://www.drupal.org/docs/develop/using-composer/manage-dependencies
If you have composer globally:
composer create-project drupal/recommended-project my_site_name_dir
Change
my_site_name_dir
to an appropriate name for your project.
Create a new, custom Drupal Theme.
Run this command from your project’s root:
php core/scripts/drupal generate-theme my_new_theme
Change
my_new_theme
to an appropriate name for your project.
Otherwise, download or create your own theme from scratch.
Update composer.json file, in project root.
Ensure to include
drush
if you would like to use it -"drush/drush": "^11.4"
. You can also runcomposer require drush/drush
Create a package.json file, in theme root.
Add what you need. Here’s a helpful example with explanation: https://www.hook42.com/blog/nodejs-version-control-drupal-themes
Run the following, suggested commands:
npm cache clean --force
nvm ls
Prints the node versions installed on your machine & the current node version you're using.nvm use 16
npm install
npm cache clean --force
If you run into a problem, and want to try again:
rm -r node_modules
This will remove the node_modules folder in your repository. If you are using Webpack, you can also remove thedist
folder usingrm -r dist
and re-build your repository.
If you are updating an existing Node 14 project, that uses npm
node-sass
, you will need to make a few changes before updating to Node 16 and npmsass
.What is the difference? Read these first - https://www.npmjs.com/package/node-sass/v/7.0.1 vs https://www.npmjs.com/package/sass
Node-Sass
Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass.
Are you running a M1 mac? ARM64 isn't supported by any version of node-sass right now.If you try to run
npm install
will error out. Instead, run these first while also reviewing from the start of this section:npm uninstall node-sass
npm install sass
ornpm i sass --save
ornpm install node-sass@npm:sass
Create a Lando, or DDev project.
Start the project.
Potential warning or errors known with changing site version to 10 - changing Node to version 16 - using (node) SASS:
Deprecation Warning: $weight: Passing a number without unit % (30) is deprecated.
Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
https://stackoverflow.com/questions/70971967/cant-install-node-sass6-for-node-v16
https://stackoverflow.com/questions/60394291/error-node-modules-node-sass-command-failed
https://www.drupal.org/project/bootstrap_sass/issues/3259490
https://www.drupal.org/project/drupal/issues/3261734#comment-14421915
https://stackoverflow.com/questions/69312134/error-with-node-sass-when-running-npm-install
Possibly relevant:
We are using https://www.npmjs.com/package/jpegtran-bin , but should be using https://www.npmjs.com/package/imagemin-jpegtran?
Additional, helpful links: