Node.js 在带有 m1 芯片的 macbook 上。 'npm run dev' 呈现错误

Node.js on macbook with m1 chip. 'npm run dev' presenting with error

安装 node 和 npm 后,我终于设法显示了 node 和 npm 版本。

npm install

在不断失败后设法工作。我运行

npm init 

然后连续按回车然后它就起作用了。现在每当我 运行

npm run dev

我收到以下错误;

    adnansaid@pc-200-38 smartMeals % npm run dev                   

> dev
> npm run development


> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js

[webpack-cli] Error: [BABEL]: Cannot find module '@babel/helper-plugin-utils'
Require stack:
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/preset-env/lib/available-plugins.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/preset-env/lib/filter-items.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/preset-env/lib/index.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/core/lib/config/files/module-types.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/core/lib/config/files/configuration.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/core/lib/config/files/index.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/core/lib/index.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/FileCollection.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/tasks/Task.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/tasks/ConcatenateFilesTask.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/components/Combine.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/components/ComponentRegistrar.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/Mix.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/setup/webpack.config.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/webpack-cli/lib/webpack-cli.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/webpack-cli/lib/bootstrap.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/webpack-cli/bin/cli.js
- /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/webpack/bin/webpack.js (While processing: /Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/preset-env/lib/index.js)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js:8:26)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/preset-env/lib/available-plugins.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/preset-env/lib/filter-items.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/preset-env/lib/index.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/core/lib/config/files/module-types.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/core/lib/config/files/configuration.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/core/lib/config/files/index.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/@babel/core/lib/index.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/FileCollection.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/tasks/Task.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/tasks/ConcatenateFilesTask.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/components/Combine.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/components/ComponentRegistrar.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/src/Mix.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/laravel-mix/setup/webpack.config.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/webpack-cli/lib/webpack-cli.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/webpack-cli/lib/bootstrap.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/webpack-cli/bin/cli.js',
    '/Users/adnansaid/Desktop/MindSpace/smartMeals/node_modules/webpack/bin/webpack.js'
  ]
}

我该怎么做才能解决这个问题,因为我希望能够开始工作。在较旧的 macbook 上工作时,安装 node.js 是最简单的事情,现在似乎是最困难的。

安装这个 npm 包然后尝试运行它

npm install --save-dev @babel/cli @babel/core @babel/preset-env