我运行离子项目时遇到错误: 构建Ionic 3应用程序1时出现错误
[ERROR] ionic-app-scripts has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
ionic3-firebase-shopping-cart-master anand$ ionic cordova run android
> ionic-app-scripts build --target cordova --platform android
/Users/anand/projects/Ionic/ShoppingCart/ionic3-firebase-shopping-cart-master/node_modules/node-sass/lib/binding.js:13
throw new Error(errors.unsupportedEnvironment());
^
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (64)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.5.3
at module.exports (/Users/anand/projects/Ionic/ShoppingCart/ionic3-firebase-shopping-cart-master/node_modules/node-sass/lib/binding.js:13:13)
at Object.<anonymous> (/Users/anand/projects/Ionic/ShoppingCart/ionic3-firebase-shopping-cart-master/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/anand/projects/Ionic/ShoppingCart/ionic3-firebase-shopping-cart-master/node_modules/@ionic/app-scripts/dist/core/bundle-components.js:6:16)
[ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts build --target cordova --platform android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
ionic3-firebase-shopping-cart-master anand $ ionic cordova平台rm ios
cordova平台删除ios --save 正在从config.xml文件中删除平台ios ... ionic3-firebase-shopping-cart-master anand $ ionic cordova运行android ionic-app-scripts build --target cordova --platform android /用户/ anand /项目/离子/ShoppingCart/ionic3-firebase-shopping-cart-master/node_modules/node-sass/lib/binding.js:13 抛出新错误(errors.unsupportedEnvironment());
答案 0 :(得分:5)
长时间尝试后,我使用以下命令解决了此问题:
npm install @ionic/app-scripts@latest --save-dev
它奏效了。
希望它将对某人有所帮助
答案 1 :(得分:1)
删除项目中的整个node_modules
文件夹,然后运行以下命令:
npm install @ionic/app-scripts@latest --save-dev
它将正常工作。
答案 2 :(得分:0)
遇到了相同的问题(节点v10.3.0,离子3.13.0)。这可行:
删除package-lock.json,
删除node_modules文件夹,
再次运行npm install。
答案 3 :(得分:0)
对我来说,问题是最新的应用程序脚本版本。我通过更改
降级了"@ionic/app-scripts": "3.2.4"
package.json中的
"@ionic/app-scripts": "3.2.3"
并运行
npm install