在尝试使用“离子服务”构建应用程序时,我是ionic框架的新手,我遇到了错误: 找不到模块node_modules \ @ionic \ app-scripts
错误
$ ionic serve
Error: Cannot find module 'E:\myapp_dwai\myapp_dwai_ap\node_modules\@ionic\app-scripts'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Mehroz\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\cli-utils\lib\ionic-angular\app-scripts.js:9:16) at Generator.next (<anonymous>)
at C:\Users\Mehroz\AppData\Roaming\npm\node_modules\ionic\node_modules\tslib\tslib.js:107:75
at new Promise (<anonymous>)
at Object.__awaiter (C:\Users\Mehroz\AppData\Roaming\npm\node_modules\ionic\node_modules\tslib\tslib.js:103:16)
at Object.importAppScripts (C:\Users\Mehroz\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\cli-utils\lib\ionic-angular\app-scripts.js:7:20)
这是我的离子信息
离子信息
$ ionic info
[ERROR] Error with .\node_modules\ionic-angular\package.json file: FILE_NOT_FOUND
[ERROR] Error with .\node_modules\@ionic\app-scripts\package.json file: FILE_NOT_FOUND
cli packages: (C:\Users\Mehroz\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 6.5.0
local packages:
@ionic/app-scripts : not installed
Cordova Platforms : android 6.2.3 browser 4.1.0
Ionic Framework : not installed
System:
Node : v8.11.2
npm : 6.1.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
运行npm后,将其安装到我的项目中
$ npm cache clean --force
使用--force警告npm,我当然希望您知道自己在做什么。
Mehroz@DESKTOP-6L29EKQ MINGW64 /e/myapp_dwai/myapp_dwai_ap
$ npm i
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\color-convert-6ff97655\package.json'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\color-convert-6ff97655\README.md'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\color-convert-6ff97655\LICENSE'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\color-convert-6ff97655\conversions.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\plist-73d7a262\examples\browser\index.html'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\elementtree-e83b5bf3\tests\data\xml1.xml'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\elementtree-e83b5bf3\tests\data\xml2.xml'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\tr_global\node_modules\x'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\express\node_modules\depd\lib'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\express\node_modules'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-common-8a5036c8\src\CordovaError\CordovaError.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-common-8a5036c8\src\CordovaError\CordovaExternalToolErrorContext.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\tr_once\main.js'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\express\node_modules'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-android-d5c98122\bin\templates\project\res\mipmap-xhdpi\icon.png'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\test\packages\npm-test-optional-deps\test.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\attempt.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\iteratee.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\matches.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\matchesProperty.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\method.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\identity.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\mixin.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\noop.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\property.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\propertyOf.js'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-app-hello-world-85cc26ee\template_src\res\icon'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\range.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\constant.js'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-app-hello-world-85cc26ee\template_src'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\times.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\callback.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\uniqueId.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\lodash-773f12e1\utility\methodOf.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\co\package.json'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\co\LICENSE'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\co\index.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\co\History.md'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\co\Readme.md'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\acosh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\fscale.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\hypot.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\iaddh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\imul.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\fround.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\index.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\isubh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\log10.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\log1p.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\log2.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\expm1.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\rad-per-deg.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\degrees.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\radians.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\deg-per-rad.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\scale.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\cosh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\sign.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\clz32.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\signbit.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\clamp.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\sinh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\cbrt.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\tanh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\atanh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\trunc.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\asinh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\umulh.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\core-js-556cdf2c\fn\math\imulh.js'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\ionic-angular-6b4598b4\es2015\components\thumbnail'
npm ERR! code E404
npm ERR! 404 Not Found: ansi-styles@2.2.0
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\chownr\package.json'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\chownr\README.md'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\chownr\LICENSE'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\chownr\chownr.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\chalk\node_modules\strip-ansi\package.json'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\chalk\node_modules\strip-ansi\index.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\chalk\node_modules\strip-ansi\license'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\chalk\node_modules\strip-ansi\readme.md'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\chalk\node_modules'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\dezalgo\package.json'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\dezalgo\README.md'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\dezalgo\LICENSE'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\dezalgo\dezalgo.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\dezalgo\.travis.yml'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\concat-map\package.json'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\concat-map\LICENSE'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\concat-map\index.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\concat-map\.travis.yml'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\fsevents-664eb46c\node_modules\concat-map\README.markdown'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\field\miss.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\field\object.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\field\string.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\field\sub.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\maxlisteners\main.js'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules\init-package-json\node_modules\promzard\example'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\npm-ae6b0b6e\node_modules'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\express\node_modules\accepts\node_modules'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\bundle_external\boop.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\bundle_external\main.js'
npm WARN tar ENOENT: no such file or directory, open 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\browserify-58497d2f\test\bundle_external\robot.js'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve\node_modules\express\node_modules\send'
npm WARN tar ENOENT: no such file or directory, lstat 'E:\myapp_dwai\myapp_dwai_ap\node_modules\.staging\cordova-browser-d41cc42c\node_modules\cordova-serve'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Mehroz\AppData\Roaming\npm-cache\_logs\2018-06-27T07_25_21_804Z-debug.log
答案 0 :(得分:0)
npm install -g ionic
不会安装到您的项目节点文件夹中。这是要在全球范围内安装cli。这似乎已经根据您的ionic info
输出安装了。
您必须在项目文件夹中运行npm install
命令,该命令将安装package.json中设置的依赖项
答案 1 :(得分:-1)
注意:尝试通过删除旧的节点模块来再次安装节点模块,然后 确保在源文件所在的位置运行“离子服务”
命令
npm install -g ionic