fs.readdir(strPostDir, function (err, files) { if (err) { returnconsole.error(err); }
try { files.forEach(function (file) { // console.log( file ); // if (file == '0模版.md'){ if (file.toLowerCase().indexOf('netsuite') != -1) { console.log(file);
//读取文件,并且替换文件中指定的字符串 let replaceFile = function (filePath, sourceRegx, targetStr) { fs.readFile(filePath, function (err, data) { if (err) { return err; } let str = data.toString();
// console.info(str);
str = str.replace(sourceRegx, targetStr);
// console.info("AFTER: \n" + str); fs.writeFile(filePath, str, function (err) { if (err) return err; });
npm warn cli npm v11.0.0 does not support Node.js v20.10.0. This version of npm supports the following node versions: `^20.17.0 || >=22.9.0`. You can find the latest version at https://nodejs.org/. 11.0.0
npm install -g npm npm warn cli npm v11.0.0 does not support Node.js v20.10.0. This version of npm supports the following node versions: `^20.17.0 || >=22.9.0`. You can find the latest version at https://nodejs.org/. npm error code EACCES npm error syscall rename npm error path /usr/local/lib/node_modules/npm npm error dest /usr/local/lib/node_modules/.npm-i9nnxROI npm error errno -13 npm error [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'] { npm error errno: -13, npm error code: 'EACCES', npm error syscall: 'rename', npm error path: '/usr/local/lib/node_modules/npm', npm error dest: '/usr/local/lib/node_modules/.npm-i9nnxROI' npm error } npm error npm error The operation was rejected by your operating system. npm error It is likely you do not have the permissions to access this file as the current user npm error npm error If you believe this might be a permissions issue, please double-check the npm error permissions of the file and its containing directories, or try running npm error the command again as root/Administrator. npm error A complete log of this run can be found in: /Users/carlzeng/.npm/_logs/2025-02-04T00_15_58_385Z-debug-0.log
Bun is a fast JavaScript all-in-one toolkit Develop, test, run, and bundle JavaScript & TypeScript projects—all with Bun. Bun is an all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager. Bun aims for 100% Node.js compatibility.