我尝试了Github问题中提到的各种方法,但无法解决以下警告-
当我执行yarn build
时,会收到如下警告-
WARNING in ./node_modules/adm-zip/util/fileSystem.js
Module not found: Error: Can't resolve 'original-fs' in './node_modules/adm-zip/util'
@ ./node_modules/adm-zip/util/fileSystem.js
@ ./node_modules/adm-zip/util/utils.js
@ ./node_modules/adm-zip/util/index.js
@ ./node_modules/adm-zip/adm-zip.js
我的package.json
看起来像这样
{
"name": "MyApp",
"version": "0.2.1",
"description": "My Command Line Interface",
"repository": "https://mylink.com/MyApp",
"main": "myApp.js",
"bin": {
"myApp": "./dist/myApp.js"
},
"files": [
"dist/"
],
"author": "MySelf",
"license": "UNLICENSED",
"private": false,
"scripts": {
"build": "webpack --config webpack.config.js",
"commit": "yarn git-cz",
"commitmsg": "commitlint -e $GIT_PARAMS",
"lint": "eslint --ext .js src",
"lint:watch": "yarn esw -w src",
"release": "standard-version -n",
"start": "yarn build --watch & yarn test --notify --silent --watch & yarn lint:watch",
"test": "jest",
"unit:ci": "jest"
},
"dependencies": {
"@angular/cli": "^7.3.4",
"@vue/cli": "3.4.1",
"adm-zip": "^0.4.13",
"chalk": "2.4.2",
"cheerio": "^1.0.0-rc.2",
"commander": "2.19.0",
"cross-spawn": "^6.0.5",
"dotenv-webpack": "^1.7.0",
"find-up": "3.0.0",
"glob": "^7.1.3",
"inquirer": "6.2.1",
"inquirer-autocomplete-prompt": "1.0.1",
"inquirer-fuzzy-path": "1.0.0",
"log-symbols": "2.2.0",
"ora": "3.0.0",
"request": "^2.88.0",
"simple-git": "^1.96.0",
"yo": "^2.0.5"
},
"devDependencies": {
"@commitlint/cli": "7.3.2",
"@commitlint/config-conventional": "7.3.1",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-preset-env": "^1.7.0",
"command-exists": "^1.2.7",
"commitizen": "3.0.5",
"cz-conventional-changelog": "2.1.0",
"debug": "^4.1.1",
"dotenv": "^6.2.0",
"eslint": "^5.4.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.1.3",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-standard": "^4.0.0",
"eslint-watch": "^4.0.2",
"imports-loader": "0.8.0",
"jest": "^23.6.0",
"regenerator-runtime": "^0.13.1",
"webpack": "4.29.6",
"webpack-build-notifier": "0.1.31",
"webpack-cli": "3.3.0",
"yorkie": "^2.0.0",
"lodash": "^4.17.11"
},
"engines": {
"node": ">= 10.12.0",
"npm": ">= 3.0.0",
"yarn": ">= 1.7.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"gitHooks": {
"commit-msg": "commitlint -e $GIT_PARAMS",
"pre-commit": "yarn run lint",
"pre-push": "yarn run lint && yarn run test"
}
}
webpacl.config.js
如下所示-
const path = require('path')
const webpack = require('webpack')
const WebpackBuildNotifierPlugin = require('webpack-build-notifier')
const Dotenv = require('dotenv-webpack');
function srcPath (subdir) {
return path.join(__dirname, 'src', subdir)
}
module.exports = {
mode: 'production',
target: 'node',
entry: './src/myApp.js',
output: {
filename: 'myApp.js'
},
plugins: [
new Dotenv(),
new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
new WebpackBuildNotifierPlugin({
title: 'MyApp CLI Build',
logo: path.resolve('./myApp-logo.png'),
sound: false
})
],
module: {
rules: [
// corrects "can't resolve './rx.lite'" issue from inquirer-fuzzy-path, see:
// https://github.com/Reactive-Extensions/RxJS/issues/1117#issuecomment-308210947
{
test: /rx\.lite\.aggregates\.js/,
use: 'imports-loader?define=>false'
}
]
}
}
我尝试了不同的方法,但失败了-
node: { fs: 'empty' }
target: 'node'
替换为target: 'async-node'
还有其他解决方法吗?还是我错过了什么?
答案 0 :(得分:0)
我可以通过将其添加到package.json中来修复它:
-
name: Check file
#hosts: all
hosts: 127.0.0.1
connection: local
tasks:
- name: "Check stat"
stat:
path: /home/path/to/file
register: st
# the following task will execute when the file has the desired permissions 0755 in this case
- name: "Assert rights"
debug:
msg: "File has {{ st.stat.mode }}"
when: st.stat.mode == "0775"