2

While generating a pipe file using ionic cli by

ionic g pipe example

results in the following error:

Error: ENOENT: no such file or directory, open '<PROJECT_PATH>/src/PIPES/example.module.ts'
    at Object.fs.openSync (fs.js:652:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at createCommonModule (/home/future/Projects/SmartUpCode/smartupcrm-mobile/node_modules/@ionic/app-scripts/dist/generators/util.js:77:10)
    at Object.<anonymous> (<PROJECT_PATH>/node_modules/@ionic/app-scripts/dist/generators/util.js:238:29)
    at step (<PROJECT_PATH>e/node_modules/@ionic/app-scripts/dist/generators/util.js:32:23)
    at Object.next (<PROJECT_PATH>/node_modules/@ionic/app-scripts/dist/generators/util.js:13:53)
    at fulfilled (<PROJECT_PATH>/node_modules/@ionic/app-scripts/dist/generators/util.js:4:58)
    at <anonymous>
4

1 回答 1

2

This "Error: ENOENT: no such file or directory," error while generating pipes occurs because of using wrong usage of directory path in native ionic config.js file.

node_modules > @ionic > app-scripts > dist > util > config.js file

The problem can be solved by changing the UPPERCASE 'PIPES' name to LOWERCASE 'pipes' in the path for generating the example.module.ts file as given below;

context.pipesNgModulePath = path_1.resolve(getConfigValue(context, '--pipesNgModulePath', null, Constants.ENV_PIPES_NG_MODULE_PATH, Constants.ENV_PIPES_NG_MODULE_PATH.toLowerCase(), path_1.join(context.srcDir, 'PIPES', 'pipes.module.ts')));

(context.srcDir, 'pipes', 'pipes.module.ts')

Then it works well...

于 2017-09-27T12:32:23.407 回答