Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
654 views
in Technique[技术] by (71.8m points)

vagrant - New Linux Laravel Homestead Breeze installation and npm broken

After 30 years of developing on Windows, I wanted to switch to Linux, specifically for Laravel dev. I have a fresh Mint 20 install, installed Vagrant and Virtual Box, installed a new Homestead Laravel 8 instance, but when I went to install Breeze, everything fell apart. It looks like NPM DEV hasn't installed correctly, or at least the CSS and JS dependencies didn't.

I know Vagrant/Homestead should make spinning up a new project a snap, but when it goes wrong it's a quagmire and very challenging to diagnose.

If I check for versions in the SSH terminal for my project, I get the following, which looks great:

vagrant@cno:~$ npm version
{
  npm: '6.14.8',
  ares: '1.16.1',
  brotli: '1.0.9',
  cldr: '37.0',
  icu: '67.1',
  llhttp: '2.1.3',
  modules: '83',
  napi: '7',
  nghttp2: '1.41.0',
  node: '14.13.1',
  openssl: '1.1.1g',
  tz: '2020a',
  unicode: '13.0',
  uv: '1.40.0',
  v8: '8.4.371.19-node.16',
  zlib: '1.2.11'
}

But doing the same in the project folder on the host laptop, I get different version, in particular for Node, indicating an out-of-date version. From reading looks like I need v.>12 for Node:

stephen@stephen-Satellite-C55D-A:~/Websites/CNO$ npm version
{ npm: '6.14.11',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '36.1',
  http_parser: '2.9.3',
  icu: '66.1',
  modules: '64',
  napi: '5',
  nghttp2: '1.40.0',
  node: '10.19.0',
  openssl: '1.1.1d',
  tz: '2020f',
  unicode: '13.0',
  uv: '1.34.2',
  v8: '6.8.275.32-node.55',
  zlib: '1.2.11' }

The error I got when installing NPM DEV and when trying to update it is:

stephen@stephen-Satellite-C55D-A:~/Websites/CNO$ sudo npm run dev
[sudo] password for stephen:        

> @ dev /home/stephen/Websites/CNO
> npm run development


> @ development /home/stephen/Websites/CNO
> mix

[webpack-cli] /home/stephen/Websites/CNO/node_modules/laravel-mix/src/Mix.js:18
    static _primary = null;
                    ^

SyntaxError: Unexpected token =
    at new Script (vm.js:83:7)
    at NativeCompileCache._moduleCompile (/home/stephen/Websites/CNO/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
    at Module._compile (/home/stephen/Websites/CNO/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/home/stephen/Websites/CNO/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at module.exports (/home/stephen/Websites/CNO/node_modules/laravel-mix/setup/webpack.config.js:2:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `mix`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ development 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!     /root/.npm/_logs/2021-01-26T17_09_45_915Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ dev 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!     /root/.npm/_logs/2021-01-26T17_09_46_019Z-debug.log

The login and registration pages (Breeze) have broken formatting, and AFAIK this is likely because I have an old version of Node in my environment (though I have the correct version in the Homestead instance). Following the instructions on the Tailwind site for this issue gives the following warnings and doesn't update Node:

stephen@stephen-Satellite-C55D-A:~/Websites/CNO$ sudo npm install tailwindcss@latest postcss@latest autoprefixer@latest
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12.13.0"} (current: {"node":"10.19.0","npm":"6.14.11"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ [email protected]
+ [email protected]
+ [email protected]
updated 3 packages and audited 1197 packages in 36.148s

89 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

So I seem to be getting deeper and deeper down this rabbit hole and am thinking of throwing in the towel and either starting over or going back to Windows with Laragon which works great for me.

Any thoughts or suggestions?

question from:https://stackoverflow.com/questions/65910805/new-linux-laravel-homestead-breeze-installation-and-npm-broken

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...