LoginSignup
0
0

More than 5 years have passed since last update.

NodeOSを試す続編(動かなかったnpkgが動いたのとtouchができた!)

Last updated at Posted at 2016-05-18

前回投稿
の続きです。

あまり大した情報があるわけではないですが、起きたこととできたことを書いてみます。
正直、正しいかどうかとかほぼわからない手探り状態です、、、

npkgとかnpmができない

初期状態だとnpkgとかnpmすると必ず失敗します。

どうやら見に行ってるregistryが

http://linux-x86.node-os.com/

らしく、ここに直接アクセスするとBasic認証かかってるので、そりゃ無理だよなってなります(´・ω・`)

一旦試しにregistry変更してみた

ということで、見に行くregistryを変更してみました。

$ npm set registry http://registry.npmjs.org/

これで見に行くregistryは変更できました。

touchをインストール

誰か知りませんが、touchをnodeで書いてくれてる人がいるので、インストールします。

$ npkg install touch

これでtouchが/root/binの下にインストールされたようです。

touchしてみる

実際にtouchしてみます。

$ touch test.txt
test.txt { dev: 2057,
  mode: 33188,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: 4096,
  ino: 120181,
  size: 0,
  blocks: 8,
  atime: Wed May 18 2016 10:24:46 GMT+0000 (UTC),
  mtime: Wed May 18 2016 10:24:46 GMT+0000 (UTC),
  ctime: Wed May 18 2016 10:24:46 GMT+0000 (UTC) }

実行された!

$ ls
[ '.node-gyp',
  '.npm',
  '.npmrc',
  'bin',
  'etc',
  'lib',
  'node_modules',
  'test.txt',
  'tmp' ]

lsするとちゃんとファイル増えてるので成功したっぽいです!

消してみる

標準でrmコマンドがあるようなので、ついでに試してみます。

$ rm test.txt

特に何も標準出力されませんでしたが、一応成功したみたいです

$ ls
[ '.node-gyp',
  '.npm',
  '.npmrc',
  'bin',
  'etc',
  'lib',
  'node_modules',
  'tmp' ]

その他できなかったこと

やってみて失敗したことをまとめます。

rmでディレクトリ削除

するとエラーします

$ rm -r test/
fs.js:760
  return binding.unlink(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '-r'
    at Object.fs.unlinkSync (fs.js:760:18)
    at Object.<anonymous> (/root/lib/node_modules/bin-fs/bin/rm:7:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

nodeコマンドを-eでconsole.logして標準出力をファイル出力的な

できませんでした、、、

$ node -e "console.log('aaa');" > test.txt
$ cat test.txt

ファイル出力されず、、、


相変わらず謎多すぎですが、まだちょっと遊んでみようと思ってます。
せめてviが使えるようになりたい、、、!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0